Re: Suppress MSVC warnings about flexible array members

220 views
Skip to first unread message

Jim Van Verth

unread,
Apr 25, 2016, 3:31:18 PM4/25/16
to skia-discuss
C99 isn't a subset of C++. At the bottom of that Wikipedia page it says that C++ doesn't have flexible array members.

On Mon, Apr 25, 2016 at 3:28 PM, Chris Dalton <cda...@nvidia.com> wrote:
If you try to compile a flexible array member in Skia, MSVC barfs up this nonsense:

  warning C4200: nonstandard extension used : zero-sized array in struct/union

I can't make any sense of that warning because flexible array members are standard C99: https://en.wikipedia.org/wiki/Flexible_array_member

Is there any reason for us to not suppress the warning? Skia already uses flexible array members anyway, just in hacky ways that circumvent the MSVC warning. See:

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

Mike Klein

unread,
Apr 25, 2016, 3:37:47 PM4/25/16
to skia-discuss
Just wanted to point out this is not limited to flexible array members.  Skia would benefit in readability from several other C99 features, and we go through awkward hoops to avoid or emulate them in C++:
  • anonymous structs
  • variable-length arrays
  • designated initializers
  • compound literals
  • restrict

Brian Salomon

unread,
Apr 25, 2016, 3:51:58 PM4/25/16
to skia-discuss
If all the compilers we support allow a particular C99 feature as an extension to C++ should we disable associated warnings?

Mike Klein

unread,
Apr 25, 2016, 4:01:01 PM4/25/16
to skia-discuss
I don't think convincing the Skia team is the long poll here.

Brian Salomon

unread,
Apr 25, 2016, 4:19:35 PM4/25/16
to skia-d...@googlegroups.com
Do we have known clients that care?

Mike Klein

unread,
Apr 25, 2016, 4:20:12 PM4/25/16
to skia-d...@googlegroups.com
Chrome cares about everything.
Reply all
Reply to author
Forward
0 new messages