Christian Kamm wrote:
Christian Kamm:
Maybe we could enable them conditionally?

pragma(parser, enable_cstyle_func_and_array_decls);
{
   int (*x[5])[3];
}

Stewart Gordon wrote:
What would this do?  Enable C-style declarations for the whole source
file?
From this point forward?  Within the active scope?  If it's meant to apply
to the content of the given {}, then there should be a semicolon there.

I assume you mean 'should not be'. That's true, but I didn't want to alter
the grammar of the pragma statement to allow for it.

How do you mean, alter the grammar? Pragmas allow
-----
pragma(ident)              // influence block of declarations
{   declaration;
    declaration;
}
-----
with this type of semantic (see http://www.digitalmars.com/d/1.0/pragma.html).

Since there's no dedicated mechanism for compiler control, there aren't many
options. I guess a version(CStyle_decls) with the side effect of enabling
the parsing of C style declarations inside its block could work too. But
it's not pretty either.

That's an ugly hack. Don't use a version to do a pragma's job.



Anyway, my vote is for eliminating C-style declarations altogether.

Reply via email to