Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 506933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:45:08+00:00 2026-05-13T06:45:08+00:00

By common I don’t mean utility, I mean a header that holds enums that

  • 0

By common I don’t mean utility, I mean a header that holds enums that multiple types want to use, etc.

For example, if multiple types can have a Color, which is an enum, you’d want to make that available. Some people would say to put it into the class that it “fits best with”, but this can create header dependency issues.

I really dislike creating a header that contains things like this, because it seems like it makes the code more complex. I’m looking for other’s thoughts on what techniques they employ when they run into a situation like this. If they use a “Common” header, etc.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:45:08+00:00Added an answer on May 13, 2026 at 6:45 am

    I always use a Common.h file that almost never changes and contains definitions that are extremely likely to be needed in virtually all files. I think it increases productivity so that you don’t have to open another .cpp file and copy the list of all the headers you know you’ll definitely need.

    For example, here are two excerpts from my Common.h:

    typedef unsigned char uint8;
    typedef signed char int8;
    typedef unsigned char uint08;
    typedef signed char int08;
    typedef unsigned short uint16;
    typedef signed short int16;
    typedef unsigned int uint32;
    typedef signed int int32;
    typedef unsigned long long uint64;
    typedef signed long long int64;
    typedef const char cchar;
    typedef const bool cbool;
    typedef char Byte;
    

    #ifdef ASSERT
    /* Re-defining assert */
    #undef ASSERT
    #endif
    
    #ifdef DEBUG
    #ifndef ASSERTIONS
    #define ASSERTIONS
    #endif
    #endif
    
    #define ASSERT_ALWAYS(Expression)   if (!(Expression)) FatalError(ErrorInfo("Assertion Failure", #Expression, FUNCTION_NAME, __FILE__, __LINE__))
    
    #ifdef ASSERTIONS
    #ifdef DEBUG
    #define ASSERT(Expression)   ASSERT_ALWAYS(Expression)
    #else
    #define ASSERT(Expression)   if (!(Expression)) ErrorLog("[Release Assertions]: The following assertion failed: " # Expression)
    #endif
    #else
    #define ASSERT(Expression)
    #endif
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example, I don't want to use org.testng.v6.Maps , (I want com.google.common.collect.Maps ) I
How can I use common forward for all actions. I mean I don't want
Common scenario: I have a library that uses other libraries. For example, a math
I don't want to write custom auth backend and I think such common task
I use Vim as my editor. Practical common Lisp suggest installing Lispbox, I don't
I don't know if that's a common problem. Most of the times that we
I would like to know how to use the common mysql_* stuff. I don't
I'm having trouble with a simple auto-increment using common table expressions. (I don't want
EXAMPLE 1: <body> <div> <h1>category1</h1><a>sibling1</a><a>sibling2</a><h1>category2</h1><a>sibling3</a><a>sibling4</a> </div> </body> so they don't have a common ancestor
I don't use java much so what are the common (best practice) locations to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.