Hirdetés

Új hozzászólás Aktív témák

  • Jester01
    veterán

    Miért ne lenne szabványos? b+++--a ugyanaz, mint (b++) + (--a).
    (Prog1-ből voltak ilyenek régesrég BME-n.)

    Én most túl fáradt vagyok foglalkozni vele.
    De ha holnap se lesz válasz, nekiülök.

    Na nem azért nem szabványos :N
    C szabvány, 6.5.2 bekezdés:

    Between the previous and next sequence point an object shall have its stored value modified at most once by the evaluation of an expression. Furthermore, the prior value shall be read only to determine the value to be stored.

    This paragraph renders undefined statement expressions such as
    i = ++i + 1;

    Márpedig az adott kódban ilyenek vannak.

    Egyébiránt GCC meg is mondja:
    ph.c: In function 'main':
    ph.c:5: warning: operation on 'b' may be undefined
    ph.c:5: warning: operation on 'a' may be undefined
    ph.c:10: warning: operation on 'd' may be undefined
    ph.c:10: warning: operation on 'c' may be undefined

Új hozzászólás Aktív témák