lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Yes not only will that work but if you guessed it is a direct string replacement for the entire file you'd be right!

Try running most C code through cpp and look at the output. Any non-trivial example will contain half the files in /usr/include on most Linux systems. 

For fun take a program that includes SDL.h 

  #include <SDL.h>
  int main(int argc, char** argv) { return 0;}

On my Mac this generates a C file 13977 lines long via cpp. On my Linux box a measly 4573 lines long. 

The slightly longer file that adds:

  #include <GL/gh.h>

Is 7909 lines lines on Linux. 

Awesome!

-=-=- dave@nexttolast.com -=-=-

On Oct 18, 2011, at 3:54 PM, joao lobato <btnfdp.lobato@gmail.com> wrote:

> On 10/18/11, Patrick Mc(avery <patrick@spellingbeewinnars.org> wrote:
>> 
>> It should be easier for a single developer to split code between files.
>> 
> 
> In C, is it possible to do something like this?
> 
> int function(int a){
>  int b;
>  #include "other_file.h"
>  return a + b;
> }
> 
> // other_file.h
> b = 42;
>