[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] placement of const is _not_ a matter of style ...
From: |
Mike Bianchi |
Subject: |
[groff] placement of const is _not_ a matter of style ... |
Date: |
Sat, 5 May 2018 12:18:26 -0400 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
The placement of const is _not_ a matter of style!
>> For example,
>> in C code, it is very common to see:
>>
>> const char *foo;
>>
>> which means something very different from:
>>
>> char const *foo;
>
> Actually, it doesn't. Try it.
Actually it does.
AND
char *foo const;
Also means something!
See
https://stackoverflow.com/questions/890535/what-is-the-difference-between-char-const-and-const-char
To my mind this confusion points to a weakness of C and C++.
It would be much less of an issue if I could ask a compiler.
What is the type of foo ?
to be certain excacty what I was dealing with when referencing foo .
((Or is there something out there I am not aware of?))
((Where is Dennis Ritchie when you need him? RIP))
GCC has a typeof keyword, but that _duplicates_ a type.
http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Typeof.html
--
Mike Bianchi
Foveal Systems
973 822-2085
address@hidden
http://www.AutoAuditorium.com
http://www.FovealMounts.com