Question: I've googled and googled and either google is failing me or you can't do this. This warning comes up when you turn on `-Wpedantic`...

> 
> ISO C++ forbids zero-size array ‘variable’ [-Wpedantic]
> 
> 
> 

I want to turn off this one warning, not all pedantic warnings.
Normally, I'd just add `-Wno-xyz` but I can't find the flag name that relates to that warning. It's just not listed anywhere.

Are the pedantic warnings special in that you can't remove them individually?

Answer: 
The good news: You *can* do this. The bad news: You can't use any commandline option. The `[-Wpedantic]` at the end of the diagnostic
tells you that `-Wno-pedantic` is the narrowest option that will disable the diagnostic, and that's no use to you if you want to preserve all
other pedantic diagnostics.

You'll have to do it case-by-case with pragmas.

**main.cpp**

```
int main(int argc, char *argv[])
{
    int a[0];
    int b[argc];
    return sizeof(a) + sizeof(b);
}

```

This program provokes two `-Wpedantic` diaqnostics:

```
$ g++ -Wpedantic -c main.cpp
main.cpp: In function ‘int main(int, char**)’:
main.cpp:6:12: warning: ISO C++ forbids zero-size array ‘a’ [-Wpedantic]
     int a[0];
            ^
main.cpp:8:15: warning: ISO C++ forbids variable length array ‘b’ [-Wvla]
     int b[argc];
               ^

```

`-Wno-vla` will suppress the second one. To suppress the first, you have to
resort to:

**main.cpp (revised)**

```
int main(int argc, char *argv[])
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
    int a[0];
#pragma GCC diagnostic pop
    int b[argc];
    return sizeof(a) + sizeof(b);
}

```

With which:

```
$ g++ -Wpedantic -c main.cpp
main.cpp: In function ‘int main(int, char**)’:
main.cpp:8:15: warning: ISO C++ forbids variable length array ‘b’ [-Wvla]
     int b[argc];
               ^

```
Well, you can use a pragma to disable it, but if you want to be portable, you can use a zero-size `std::array` instead:

```
#include <array>
//...

std::array<int, 0> ar;

```

Using `std::array` over plain arrays is recommended anyway.