On Wed, 31 Aug 2022, Qing Zhao via Gcc-patches wrote: > > How is level 3 (thus -fstrict-flex-array) interpreted when you specify > > -std=c89? How for -std=gnu89? > > 1. what’s the major difference between -std=c89 and -std=gnu89 on flexible > array? (Checked online, cannot find a concrete answer on this). > ** my understanding is: -std=c89 will not support any flexible array > (neither [], [0], [1]), but -std=gnu89 will support [0] and [1], but not []. > Is this correct?
Flexible array members are supported in all C standard modes, since they don't affect the semantics of any valid pre-C99 program (only make valid programs that were previously erroneous). With -std=c89 or -std=gnu89, -pedantic will give a warning "ISO C90 does not support flexible array members" and -pedantic-errors will change that to an error. -- Joseph S. Myers jos...@codesourcery.com