This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

a couple of compiler questions

Maybe it's just me, but I find it confusing that --no_inlining is in the "Language Options" but the rest of the inlining options are in "Optimizations".

string.h uses __OPTIMIZE_FOR_SPACE but I can't find a reference in the ARM Compiler User's Guide (V4.6) nor can i figure out where it gets defined.

Thanks for considering my questions, Jon

  • whoops....that ought to be "_OPTIMIZE_FOR_SPACE".

  • _OPTIMIZE_FOR_SPACE is a preprocessor symbol that is predefined by the compiler when no -mf option is specified, or when you use -mf0, -mf1, or -mf2.  It is not defined when you use -mf3, -mf4, or -mf5.  The option -mf is a short form for the longer alias --opt_for_speed.

    Thanks and regards,

    -George

     

     

  • Hi George,

    This is great information to have and it should be in the compiler user's guide. It does, however, raise an interesting question. You say it is set if "...no -mf option is specified,...", when the compiler user's guide says: "The default setting is --opt_for_speed=4.". If the default is -mf4, then why is _OPTIMIZE_FOR_SPACE also defined by default? This appears somewhat inconsistent to me at least...

    Thanks, Jon

  • I understand your confusion.  The documentation is not clear.  The default it is talking about here is what happens when you use --opt_for_speed without also specifying a value.  In that case, the value is 4.  If you don't mention --opt_for_speed at all, then the default value is 1.  Here is a (not so well formatted) summary:

    Command line         Equivalent --opt_for_speed level
    ------------         --------------------------------
    EMPTY                     1
    --opt_for_speed           4
    --opt_for_speed=N         N
    

    Thanks and regards,

    -George