Can you have a triple minus signs in C programming? What does it mean? [duplicate]

It is equivalent to:

iHoursTemp = iHoursTemp + (iZoneNew--) - iZoneOld;

This is in accordance with the maximal-munch principle


The correct answer is (as Rob said) the following:

iHoursTemp = iHoursTemp + (iZoneNew--) - iZoneOld;

The reason it is that way and not

iHoursTemp = iHoursTemp + iZoneNew - (--iZoneOld);

is a convention known as maximum munch strategy, which says that if there is more than one possibility for the next token, use (bite) the one that has the most characters. The possibilities in this case are - and --, -- is obviously longer.


According to Draft C++11 (PDF) 2.5 Preprocessing tokens, clause 3 and Draft C11 (PDF) 6.4 Lexical elements, clause 4, the compiler parses the longest possible sequence of characters as the next token.

This means --- will be parsed into the two tokens -- and -, which gives

iHoursTemp = iHoursTemp + (iZoneNew--) - iZoneOld;

This also shows, if you're unsure about precedence or parsing rules, use parenthesis to clarify the code.