This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bug: _REENT_INIT_PTR() macro argument needs parentheses


Minor bug...but it seems reasonable that one ought to be able to do this:

  struct _reent my_reent;
  _REENT_INIT_PTR(&my_reent);

But it doesn't work because the '->' in the macro has higher precedence than
the '&', giving you, effectively
  &(my_reent->_errno) = ...
Instead of what you want:
  (&my_reent)->_errno = ...

This can be worked around with
  _REENT_INIT_PTR((&my_reent));

But it would be preferable to change the definition of _REENT_INIT_PTR(var)
from
  { var->_errno = ...
To 
  { (var)->errno = ...







Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]