Post Reply 
newRPL: [UPDATED April 27-2017] Firmware for testing available for download
10-10-2016, 04:45 AM
Post: #413
RE: newRPL: [UPDATED September-17-16] Firmware for testing available for download
(10-09-2016 02:53 AM)Sylvain Cote Wrote:  Claudio,

The reason the compiler give you a warning is because "const char", "char const" and "const char const" are the same thing.
Also, in your hello example, the resulting pointer is not constant.

To really have a constant pointer to a constant data you need to use one of the following ...
const char * const string = "Hello"; // const char means constant data and * const means constant pointer
or
char const * const string = "Hello"; // char const means constant data and * const means constant pointer

Sylvain

My bad, I really meant "const char * const", though I double checked with the latest gcc and it didn't give me a warning for either "const char * const" or "const char const *", so I was wrong about that too, I should say "old compilers used to give a warning".
In any case, the correct syntax is the one you pointed out.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: newRPL: [UPDATED September-17-16] Firmware for testing available for download - Claudio L. - 10-10-2016 04:45 AM



User(s) browsing this thread: 13 Guest(s)