Things that may be removed
Christian Kamm
kamm-incasoftware at removethis.de
Sun Dec 21 00:44:53 PST 2008
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.
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.
> Either way, it wouldn't work. The whole point of pragmas is for features
> that a given compiler may or may not support. And if a given compiler
> doesn't support this syntax, it will fail regardless.
Well, there are a few predefined pragmas, like msg and lib. This could also
be a required, predefined one.
But don't get hung up on the syntax. My main point was that most D modules
will not use the C style declarations. They may be useful when porting
legacy code though, so being able to enable them on a per file or per block
basis seemed like a reasonable compromise if getting rid of them completely
is not an option.
More information about the Digitalmars-d
mailing list