|
|
Multiple Translation Units for Lite-C
#436073
01/18/14 12:53
01/18/14 12:53
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
OP
Serious User
|
OP
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
Hi JCL,
AFAIK there is no way to use multiple translation units in Lite-C like in standard C. I always found it very uncomfortable and very bad programming style to include C files (#include "unit1.c"). Is it possible to change the compiler to handle every .c file of a SED project as seperate translation unit? Would this require a big change in the compiler code?
Thanks!
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
Re: Multiple Translation Units for Lite-C
[Re: Dark_samurai]
#436371
01/24/14 12:00
01/24/14 12:00
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
Serious User
|
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
@Dark_samurai: you mean: so we can just include the h files and generate object files from each c file?(Which are then linked)
MY Website with news of my projects: (for example my current Muliplayer Bomberman, GenesisPrecompiler for LiteC and TileMaster, an easy to use Tile editor) Sparetime-Development
|
|
|
Re: Multiple Translation Units for Lite-C
[Re: Rackscha]
#436379
01/24/14 14:56
01/24/14 14:56
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
OP
Serious User
|
OP
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
Yes that's what I ment. In ANSI C, you don't need to include every *.c file into the main *.c file like in Lite-C. Every *.c file of the project is handled as one small unit. The linker makes 1 executeable out of the object files of every c file.
Thus information hiding can be realised (one *.c file doesn't see the global variables of another *.c file if it isn't defined as extern in the header, same for "private" function which are only seen in one *.c file). This would help making programming in Lite-C "cleaner" than it is now.
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
Re: Multiple Translation Units for Lite-C
[Re: Dark_samurai]
#436381
01/24/14 15:21
01/24/14 15:21
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
Serious User
|
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
Yes, for sure.
And you can use/declare things within a c file without fear of causing problems with other c files.
MY Website with news of my projects: (for example my current Muliplayer Bomberman, GenesisPrecompiler for LiteC and TileMaster, an easy to use Tile editor) Sparetime-Development
|
|
|
|
|
|