Previous mail
Next mail
Unformatted/full headers
Overview 10 days
Subject
Date
Thread
Author
From: Marco van de Voort
Subject: Old Bug: Global variable not initialised properly
Date: 18 May 2001, 20:16:32
> Marco van de Voort wrote: > > > > I'm not sure why you do it like this -- perhaps it's just a relic > > > from ancient times when GPC didn't know about importing interfaces. > > > In this case, I'd suggest to get rid of it. > > > Otherwise, any ideas for fixing this are welcome. > > > > The only other solution I can think of: > > > > - such modules shouldn't be allow to initialise, and have stuff that must be > > initialised global in the implementation part. (the part that is separately > > compiled) > > How? When the module is compiled, the compiler doesn't know how it > will be used? (Note that I don't judge whether it should be unsupported or not. I just come up with some possible ideas) [thinking] I see that I have made some assumptions, which I'll try to explain: It depends on how your link between the header and the module sourcefile is. When compiling the module sourcefile, is the header then checked? Iow are the header and implementation linked together (so that the header of module a is parsed before with the compilation of the module is started). If that isn't done (the header is no true interface but a mere EXTERNAL declaration), then it is impossible, because the vars are declared twice, in header and module. ------------- Otherwise a module could get a special pragma to declare it old style, and then the compiler should not generate initialisation code for interface variables. (mangled) Names of variables to be initialised globally could be stored in .gpi, and initialisation/finalisation code generated when the main module is compiled. > > - All initialisation for the variabeles in the INTERFACE, are done by the > > mainprogram. > > Again how? All the compiler sees (in Ian's example) are `external' > declarations, and initializing all external variables would in > general be wrong. Everything imported via #include should be initialised by the mainprogram, and it could be communicated back via de unit (non-object code) file. (gpi with GPC IIRC) A main program then has to check all involved GPI files. Not only the modules that the mainprogram includes, but also deeper nested stuff.
Previous mail
Next mail
Unformatted/full headers
Overview 10 days
Subject
Date
Thread
Author
| Author | Subject | Date |
|---|---|---|
| Frank Heckenbach | Old Bug: Global variable not initialised properly | 18 May 2001, 22:55:42 |
| Author | Subject | Date |
|---|---|---|
| Frank Heckenbach | Old Bug: Global variable not initialised properly | 18 May 2001, 18:47:48 |
Note: This page contains information that does not originate from the owner of this web site, but from the authors of the mails archived. The owner of this web site is not responsible for the content of such information. Any use of that infomation requires the consent of the respective author.
Where WWW addresses (URLs) in the mails archived are marked as hyperlinks, this is only for the comfort of the reader. The content of the web pages linked to like this does not necessarily reflect the opinion of the owner of this web site or of the authors of the mails archived. The owner of this web site is not responsible for the content of such web pages. Those pages are explicitly not to be considered as part of the content of this page, but merely as references.
This page was created by Crystal 0.999 (Linux 2.4.27/i686).