Re: including a large constants file

From: Mike Wahler (mkwahler_at_mkwahler.net)
Date: 01/10/05

  • Next message: Mike Wahler: "Re: (P.S.) including a large constants file"
    Date: Mon, 10 Jan 2005 02:21:00 GMT
    
    

    "john smith" <princetonharvard@charter.net> wrote in message
    news:2hlEd.14685$5E4.13879@fe03.lga...
    > Hi,
    >
    > If I have a large constants file and include that in a .cpp file will the
    > executable become large?

    Define 'large'.

    >
    > That is if I include a file with a bunch of constants does the executable
    > include all of the constants or just
    > the constants that are used in the .cpp file?

    That depends entirely upon your compiler and platform.

    >
    > I am wanting a way so that only the constants that are used are included
    in
    > the executable and not the whole file.

    Again this depends upon your compiler, and also upon the
    context in which they're used. Some might be stored in
    your program's image, some might become 'immediate' operands
    of machine instructions.

    > I am trying to reduce the size of my executable.

    None of what you ask is addressed by the language, so
    we cannot answer conclusively.

    >
    > I had trouble verifying this.
    >
    > Thanks alot for any advice.

    Consult your compiler documentation, and/or search your
    compiler's support resources.

    -Mike


  • Next message: Mike Wahler: "Re: (P.S.) including a large constants file"

    Relevant Pages

    • Re: Internal Complier Error in Visual C++ 1.52
      ... You're using a very old version of both the IDE and the compiler. ... > function declaration for an existing class in a header file and function ... > implementation in the .cpp file i am getting an error as given below ...
      (microsoft.public.dotnet.languages.vc)
    • Re: LNK2019
      ... the header will include the inline file in a release build and the cpp file ... the compiler and linker to correctly deal with this? ... "exclude from build" which applies to whatever configuration you have selected. ...
      (microsoft.public.vc.mfc)
    • Re: Preprocessor, nested files etc.
      ... > we have to do this, it takes around 2 hours for a complete recompile). ... > When the compiler compiles a *.cpp file, it starts in a fresh state. ... > it has learned by compiling a previous source code file remains. ...
      (comp.lang.cpp)
    • Re: Quick question:
      ... Can we pass a pointer to an object from one cpp file to another by ... virtual void SYS_set_SFCC ... Remember that the compiler sees only what you "feed" to it. ... convention of using "header files" - common definitions and declaration are ...
      (microsoft.public.dotnet.languages.vc)
    • Re: warning : no new line at end of file
      ... >>John Smith said: ... the reason is that it doesn't matter on Unix and other ... >standard C, and standard C requires that text files be well-behaved. ... but whether the compiler accepts EOF as equivalent to ...
      (comp.lang.c)