const int vs. int const

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 15 15:05:44 PDT 2014


On Fri, 15 Aug 2014 21:08:08 +0000
Jonathan M Davis via Digitalmars-d <digitalmars-d at puremagic.com> wrote:

> I still think that we'd be far better off if all attributes which 
> could apply to a function's return type were illegal on the 
> left-hand side of the function.
i completely agree. even if this change will break some code, i'm still
sure that it should be done.

i'm constantly beaten by writing 'const FooBar func()' (ah, pun
unintended ;-) and i can't understant why compiler is silent about it,
while it can tell me that
'1 > 0 must be parenthesized when next to operator &' in 'if (a&1 > 0)'.

please, make compiler emit at least warning about 'stray
const/immutable/etc'! and then deprecate it, and then make compiler emit
error.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140816/e3790caa/attachment.sig>


More information about the Digitalmars-d mailing list