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

  • Home
  • SEARCH
  • 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 700827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:32:29+00:00 2026-05-14T03:32:29+00:00

below i have a code that runs in most of my simple programs ..

  • 0

below i have a code that runs in most of my simple programs .. .
i want to know if it’s good/bad … and cons/pros .

.
win32 header file:
win32.h

// example of a not realated code to exaplin the question
// this header have all win32 includes like win/proces/stdarg/string ... etc
#include <windows.h>
#include <process.h>
#include <stdarg.h>

main header file:
inc.h

//this file includes the following

//top : the windows header file
#include "win32.h" // include the win32.h header file 

//the extern define which is the question
//the first include cause the INCS to be defined 
//any include afterwards causes the DD to go from 'nothing' into 'extern'
#ifndef INCS
    #define INCS
    #define DD
#else
    #define DD extern
#endif

// unrealted code to be more informative
//middle area of the file have the variables /defines or w/e
#ifndef VARS
    #define titlen L"my program"
#endif

DD wchar_t gtitle[512];
DD wchar_t gclass[512];
DD wchar_t gdir[32767];

//last area of the file
// this bottom area have the project's files' all included all headers and code
#include "resources.h"
#include "commonfunctions.cpp"

then all files have something like this
commonfunctions.cpp

//a code just to be more informative and it's not realted to the question
#include "inc.h" // no need for includings ?

DD inline bool icmp( const char *String1, const char *String2 )
{
    if ( _stricmp( String1, String2 ) == 0 ) { return true; }
    return false;
}

DD inline bool scmp( const char *String1, const char *String2 )
{
    if ( strcmp( String1, String2 ) == 0 ) { return true; }
    return false;
}

DD refers to the #define DD extern

all global variables have DD infront of them and all functions/subs have DD too, that will cause the functions to be defined as extern in all file when included for the second time

is there a bad side of this ? . i came up with this idea and it wasn’t problematic at all in small programs . but before i apply it in a large project will it be problematic ?.
.

.

Now to the Question

DD here means the #define DD extern
DD will remove the need to do a psudo outside the code or in headers
DD will remove the need to define extern variables in each page
DD will remove the need to do the #includes of each header in each file

Now will this DD that is demostrated in the code upthere be a problem in a bigger code ?

edit:
i edited the question to be more clear

thanks in advance.

  • 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-14T03:32:29+00:00Added an answer on May 14, 2026 at 3:32 am

    I think you are trying to automate the declaration of globals with extern and the single declaration without.

    a) it is much simpler to have plain ‘extern’ in the header files and just have a cpp file called gtobals with the declarations in it

    b) you dont need to do this for functions

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.