This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Request for compiler option to disable multiple declarations in a single statement

> Wars have been fought over less.

I joined the list to make the request. So I just hope my war is not in a 
lonely one-man army.

>> As for the problem of multiple declarations fraught in the suggestion
>> above, I would like gcc developers to please consider a compiler option
>> (--single-declarations perhaps) under which the programmer can only
>> introduce one declaration in one statement. If such an option could be
>> made available, it takes care of all declaration woes and lets declared
>> types bear close resemblance to what they appear to be from signatures.
> It might be appropriate as a warning option, for those who choose to
> enforce that style.

Fine - if anyone could create a warning specifically for multiple 
declarations (and which can be turned into Werror such that it breaks 
code for multiple declarations -- and absolutely nothing else), that 
serves the purpose as well as an option like --single-declarations.

I don't even mind if programmers have to use pragma directives. The end 
result I want is the programmer to have some way of getting the compiler 
break code rather than compile the code at all. Right now, it is a real 
mess that just builds on a simple oversight on the part of Dennis 
Ritchie decades back. The most maddening way to address that mess is 
drop the space between the asterisk and the pointer variable in a 
declaration. Every single thing about pointer usage goes downhill from 
that clumsy fix.

> And of course there are cases where avoiding multiple declarations
> changes the meaning of the code, such as this idiomatic C++:
> for (auto first = c.begin(), last = c.end(); first != last; ++first)

'idiomatic C++' looks more like 'idiotic C++' ever since v11/v14 came 
out. Does Stroustroupe have nothing better to do these days than to make 
a mockery of the once acceptable language ? I like C++ these days just 
as a seafarer likes a close encounter with a shark.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]