> 
> >  Since some strings are non-constant (the are allocated) - I believe
> >  the `const' qualifier in the structure declaration is incorrect.
> 
> 'const' just means "I will not be modifying this"; it's a way for a 
> function prototype to constrain the function's implementation.
> 

 Yes - it is..

 However,
  
  "a string"

 is a const array of char.

  malloc(9) 

 isn't. (And, can't be, since you have to, presumably,
 malloc the space and then write something meaningful
 to it...)

 So, if you declare a variable as

        const char *

 and then have different "constness" in assigning to that data,
 you are asking for the one variable to be both `const' and non-`const'... 
 
 I was taking it from the "other side" (not the call to free() side, but
 the declaration of the data type...)  Saying that the datum isn't
 actually `const' - it's only "sometimes const" (and only during
 the static initialization.)   "sometimes const" doesn't make sense...

 But - then, if you remove the `const' - you get warnings from
 the initialization - assigning a pointer-to-const to a  pointer-to-non-const.

 So... what's a programmer to do?  That's the issue, right?

        - Dave R. -

--
[EMAIL PROTECTED]                        Work: (919) 676-0847
Get your mainframe programming tools at http://www.dignus.com




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to