<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">
> #ifdef __GNUC__<br>
> /* or some other condition, __has_feature or what have you */<br>
> #define FLEXIBLE_ARRAY<br>
> #else<br>
> #define FLEXIBLE_ARRAY 1<br>
> #endif<br>
><br>
> struct Buffer {<br>
>  int len;<br>
>  char bytes[FLEXIBLE_ARRAY];<br>
> };<br>
><br>
> It's even self-documenting.<br>
<br>
</div>It's gross. Our community is obsessed with code hygiene, and that will<br>
never fly just to get Clang to stop complaining while every single<br>
other compiler, of which there are quite a few (PostgreSQL is supposed<br>
to be highly portable), will not complain.<br></blockquote><div><br>What exactly do you mean by code hygiene in this regard? Why would the above be unhygienic?  <br><br>I think someone mentioned the idea of adding a separate warning for this narrower case and, in the case of compiling for c99, suggesting a fixup of using a flexible array. In the case of c89 at least it'd be a separate warning that, if the pattern is used extensively in the codebase, could be disabled separately from the more general warning (which would be adjusted to ignore these cases). <br>
<br>This would allow for the bug that was mentioned to have been found, while allowing you to disable this warning if you don't think the chance of such bugs coming up is worth the code hygiene cost of the above construct or the move to c99 would be worthwhile in your case.<br>
<br>- David<br></div></div>