Community
Participate
Working Groups
Build Identifier: The write_stream macro doesn't work properly inside an 'if' statement. For example: if (condition) write_stream(x, y); else <statement>; Expands to: if (condition) { OutputStream * _s_ = (x); int _x_ = (y); if (_x_ > ESC && _s_->cur < _s_->end) *_s_->cur++ = (unsigned char)_x_; else _s_->write(_s_, _x_); }; else <statement>; The problem is the ';' after the brace before the 'else'. That semi-colon terminates the 'if' statement, so the following 'else' generates an error when compiled. One possible solution would be to define the macro like this: #define write_stream(x,y) if (1) { <code> } else It looks a little ugly - maybe there is a better way. Reproducible: Always Steps to Reproduce: 1.See above 2. 3.
Fixed by wrapping into do...while(0) Thanks.