delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/04/02/00:27:42

Date: Sat, 02 Apr 1994 00:11:32 -0500 (EST)
From: "Wonkoo Kim, EE, U. of Pittsburgh" <WKIM AT vms DOT cis DOT pitt DOT edu>
Subject: Re: storage allocation of global var
To: dj AT ctron DOT com
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu

>Date: Fri, 01 Apr 1994 17:19:52 -0500
>From: dj AT ctron DOT com (DJ Delorie)
>Subject: RE: storage allocation of global var
>
>What I do is this (in one of the .c files):
>
>	#define extern
>	#include "something.h"
>
>That makes them non-extern for that .c file only.

Yes, this seems to be a better way!

I thought this would not work in my case, but on the second thought, I 
think this would work well if I look 'extern' symbol in something.h.

The main purpose that I defined _TEST_C_ in test.c:
	#define _TEST_C_
	#include "something.h"
was to identify which module *.c included the something.h when a global var 
in something.h must be initialized.  In this case, the global var should not 
be initialized (but with extern) when some other module includes something.h.
But, I forgot that I can still see the 'extern' symbol to identify the 
caller!

Thanks, DJ.

Wonkoo Kim
wkim AT vms DOT cis DOT pitt DOT edu


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019