other than pragma

Discussion in 'C Programming' started by parag_paul@hotmail.com, Feb 10, 2008.

  1. Guest

    is there any compiler directive that will enforce optimizations?
     
    , Feb 10, 2008
    #1
    1. Advertising

  2. Eric Sosman Guest

    wrote:
    > is there any compiler directive that will enforce optimizations?


    Define precisely what you mean by "optimizations."

    --
    Eric Sosman
    lid
     
    Eric Sosman, Feb 10, 2008
    #2
    1. Advertising

  3. Guest

    On Feb 10, 9:09 pm, Eric Sosman <> wrote:
    > wrote:
    > > is there any compiler directive that will enforce optimizations?

    >
    > Define precisely what you mean by "optimizations."
    >
    > --
    > Eric Sosman
    >


    Teh optmizations that cn be achived by the compile line options -O4 etc
     
    , Feb 10, 2008
    #3
  4. In article <>,
    <> wrote:
    >On Feb 10, 9:09 pm, Eric Sosman <> wrote:
    >> wrote:
    >> > is there any compiler directive that will enforce optimizations?


    >> Define precisely what you mean by "optimizations."


    >Teh optmizations that cn be achived by the compile line options -O4 etc


    The original article has not shown up here, so I am perhaps missing
    some key context, but the answer is three-fold:

    1) C has a very limited number of standard pragmas (and no
    standard pragmas at all in C90), none of which has to do with
    optimization. Any pragma along this lines that you happened to find
    would be non-portable (but ignored by other compilers that did not
    happen to have a pragma with the same name)

    2) pragmas -suggest- rather than -enforce- .

    3) I have never encountered a C compiler with a pragma that
    affected optimization.
    --
    "All is vanity." -- Ecclesiastes
     
    Walter Roberson, Feb 10, 2008
    #4
  5. Eric Sosman Guest

    wrote:
    > On Feb 10, 9:09 pm, Eric Sosman <> wrote:
    >> wrote:
    >>> is there any compiler directive that will enforce optimizations?

    >> Define precisely what you mean by "optimizations."

    >
    > Teh optmizations that cn be achived by the compile line options -O4 etc


    If you think this is a "precise" definition, you should
    consider a career change ...

    Try again: Offer a *precise* definition of "optimizations,"
    using terms that are applicable to all systems where C is
    implemented, and that cover all (or at least most) possible
    optimality metrics. I think the effort of formulating such a
    definition will teach you something valuable, and I will applaud
    your sincere attempt enthusiastically by clapping one hand.

    --
    Eric Sosman
    lid
     
    Eric Sosman, Feb 10, 2008
    #5
  6. Tim Prince Guest

    Walter Roberson wrote:
    > In article <>,
    > <> wrote:
    >> On Feb 10, 9:09 pm, Eric Sosman <> wrote:
    >>> wrote:
    >>>> is there any compiler directive that will enforce optimizations?

    >
    >>> Define precisely what you mean by "optimizations."

    >
    >> Teh optmizations that cn be achived by the compile line options -O4 etc

    >


    > 3) I have never encountered a C compiler with a pragma that
    > affected optimization.


    This is well outside the limits of Standard C. Some of the most widely
    used compilers (e.g. gcc) have no such pragmas. icc has an extremely
    limited set for the latest versions. You would expect any such facilities
    to be documented by the compiler in question. I don't use any compiler
    which even has a -O4 option; it's fairly unusual.
     
    Tim Prince, Feb 10, 2008
    #6
  7. wrote:
    > is there any compiler directive that will enforce optimizations?


    Most compilers have means to ask them to provide a range of
    optimizations. However, those are to be found in the documentation for
    those implementations, and have nothing to do with the C language
    itself. The right place to look for this information is
    1) in the documentation that came with your compiler
    2) in FAQs for newsgroups or mailing lists or websites associated
    with your implementation
    3) in newsgroups, mailing lists, websites, or technical support for
    your implementation
    One place that it makes no sense to ask about these
    implementation-specific details is a newsgroup about the language
    itself, such as <news:comp.lang.c>.
     
    Martin Ambuhl, Feb 10, 2008
    #7
  8. On Feb 10, 4:23 pm, -cnrc.gc.ca (Walter Roberson)
    wrote:

    > 3) I have never encountered a C compiler with a pragma that
    > affected optimization.


    Metrowerks Codewarrior used to do that. Quite useful at times.
     
    christian.bau, Feb 10, 2008
    #8
  9. wrote:
    > is there any compiler directive that will enforce optimizations?


    Probably; they'll be specified in your compiler documentation.
     
    J. J. Farrell, Feb 11, 2008
    #9
  10. In article <foo46u$2vi7$>,
    J. J. Farrell <> wrote:
    > wrote:
    >> is there any compiler directive that will enforce optimizations?


    >Probably; they'll be specified in your compiler documentation.


    In common English, "probably" would imply "more likely than not".
    So far in this thread, only one compiler (icc) has been identified
    specifically as having such pragmas. Can you identify other specific
    compilers in wide use that support these kind of pragmas -- or should
    your "probably" have been "possibly" ?

    --
    "Man's life is but a jest,
    A dream, a shadow, bubble, air, a vapor at the best."
    -- George Walter Thornbury
     
    Walter Roberson, Feb 11, 2008
    #10
  11. In article <foo54f$m1t$>,
    Walter Roberson <-cnrc.gc.ca> wrote:
    >In article <foo46u$2vi7$>,
    >J. J. Farrell <> wrote:
    >> wrote:
    >>> is there any compiler directive that will enforce optimizations?

    >
    >>Probably; they'll be specified in your compiler documentation.

    >
    >In common English, "probably" would imply "more likely than not".
    >So far in this thread, only one compiler (icc) has been identified
    >specifically as having such pragmas. Can you identify other specific


    Therefore, the correct answer is more than "probably". It is certainly.

    The question being:
    >>> is there any compiler directive that will enforce optimizations?


    And the answer is: Yes, there is one. In icc. There may be others.
     
    Kenny McCormack, Feb 11, 2008
    #11
  12. Randy Howard Guest

    On Sun, 10 Feb 2008 18:33:19 -0600, Walter Roberson wrote
    (in article <foo54f$m1t$>):

    > In article <foo46u$2vi7$>,
    > J. J. Farrell <> wrote:
    >> wrote:
    >>> is there any compiler directive that will enforce optimizations?

    >
    >> Probably; they'll be specified in your compiler documentation.

    >
    > In common English, "probably" would imply "more likely than not".
    > So far in this thread, only one compiler (icc) has been identified
    > specifically as having such pragmas. Can you identify other specific
    > compilers in wide use that support these kind of pragmas -- or should
    > your "probably" have been "possibly" ?


    I think metrowerks CodeWarrior was also mentioned upthread. There are
    a lot of variants of Codewarrior for various platforms, including a lot
    of embedded ones, with various optimization pragmas. See also:

    <http://docs.hp.com/en/B3901-90017/ch03s04.html>

    <http://techpubs.sgi.com/library/tpl/cgi-
    bin/getdoc.cgi?coll=0650&db=bks&fname=/SGI_Developer/Pragmas/ch08.html>
    <http://msdn2.microsoft.com/en-us/library/aa289157(vs.71).aspx>

    <http://msdn2.microsoft.com/en-us/library/ms235601.aspx>

    <http://developer.apple.com/documentation/DeveloperTools/gcc-
    4.0.1/gcc/Darwin-Pragmas.html>

    <http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/
    com.ibm.xlcpp8a.doc/compiler/ref/rnpgoptn.htm>

    < http://www-306.ibm.com/software/awdtools/czos/features/czosv1r5.html>
    <http://www.csc.fi/english/pages/murska_guide/program_development/optimi
    zation>

    <http://www.cc65.org/doc/cc65-7.html>

    <http://www.pdc.kth.se/doc/pgi/4.1/pgiws_ug/pgiug_10.htm#Heading121>

    <http://www.keil.com/support/man/docs/armcc/armcc_babdidhg.htm>

    <http://www.htsoft.com/products/updates/show_rel_notes.php?pname=8051
    C>

    That should be sufficient to put paid to this line of argument. Not
    all the world is gcc. In fact, not even gcc is, on some architectures.
    :)


    --
    Randy Howard (2reply remove FOOBAR)
    "The power of accurate observation is called cynicism by those
    who have not got it." - George Bernard Shaw
     
    Randy Howard, Feb 11, 2008
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    9
    Views:
    13,967
    Rob Dekker
    Jul 21, 2005
  2. ryang
    Replies:
    1
    Views:
    944
    Wes Groleau
    Apr 11, 2005
  3. Titus A Ducksass
    Replies:
    1
    Views:
    6,031
    Sid Ismail
    Aug 1, 2003
  4. Replies:
    0
    Views:
    491
  5. Diego
    Replies:
    2
    Views:
    151
    Stefan Rusterholz
    Aug 16, 2008
Loading...

Share This Page