In C i can do this:
ppackage ppnull() {
return (ppackage) {
.type = NULL
}
}
However, in C++ I get syntax errors. I use the GNU g++
compiler. Is there a switch to enable this?
In C i can do this:
ppackage ppnull() {
return (ppackage) {
.type = NULL
}
}
However, in C++ I get syntax errors. I use the GNU g++
compiler. Is there a switch to enable this?
With c++11
you can use initializer list:
struct ppackage
{
void* type;
};
ppackage ppnull()
{
return {nullptr};
}
Or just
ppackage ppnull()
{
return {};
}