[OT] C function call cost.

Discussion in 'C Programming' started by Andrew Au \(Newsgroup\), Sep 16, 2004.

  1. Andrew Au \(Newsgroup\)

    Flash Gordon Guest

    I do use small functions, it's just that efficiency is not enough of a
    concern for me to analyse whether it is better to use inline or not.
    Instead I leave it up to the compiler to inline if it thinks it is
    appropriate.

    *If* efficiency becomes a concern *then* I will worry about profiling
    and seeing if I should inline some functions or do something else to
    speed it up. However, currently we can cope with a few hundred users
    (which is all we need to cope with) on a reasonable server, so both us
    and our customers are happy with the choices made by the compiler.
     
    Flash Gordon, Sep 17, 2004
    #21
    1. Advertisements

  2. Agree so far.
    On some machines, notably and commonly x86/87, but not everywhere and
    not required by the standard. What is required is that _variadic_ or
    unprototyped calls promote float to double; and it is _permitted_ that
    all (other) floating-point computations can be done in precision (and
    range) exceeding their nominal types. Stores (assignments) and
    conversions (casts) are supposed to cut back to nominal type, but on
    x86/87 it kills performance and gcc tries not to do so by default,
    even if you say -ansi etc., unless you specifically say -ffloat-store.

    - David.Thompson1 at worldnet.att.net
     
    Dave Thompson, Sep 27, 2004
    #22
    1. Advertisements

  3. Andrew Au \(Newsgroup\)

    Dan Pop Guest

    And even with -ffloat-store, gcc will manage to break conformance, in
    certain cases. It tends to ignore footnote 86 in C99 (well, it's not
    normative in the first place, although its text *definitely* should be
    normative).

    Dan
     
    Dan Pop, Sep 27, 2004
    #23
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.