------- Additional Comments From gdr at integrable-solutions dot net  
2005-05-16 02:54 -------
Subject: Re:  static_cast falsely allows const to be cast away

"schlie at comcast dot net" <[EMAIL PROTECTED]> writes:

| ------- Additional Comments From schlie at comcast dot net  2005-05-16 02:44 
-------
| (In reply to comment #5)
| > Subject: Re:  static_cast falsely allows const to be cast away
| > | > Yup, string literal should have type 'const char *'.
| > | 
| > | I believe 'static const char []' would seem most correct?
| > 
| > "static" is not part of the type.  The ty[e of a string literal is
| > "const char[N]", N being its sizeof.  There is no if no but.
| > Similar rule for wide string literal.
| 
| Then maybe GCC needs to broaden it's view of what information
| needs to be considered a type qualifier at least internally; as a
| storage specification can certainly restrict an object's permissible
| use and access, as such should be recorded and maintained as a
| qualifier for all objects, and pointers/references.

That is your view.  However, not because GCC implements the ISO C++
view of types, means that GCC has a narrow view of a type is.  I
suspect that part of your speculation is based on unfamiliarity with
both the C++ type system and the GCC internal notion of types.

| A literal string is not simply a 'const char [N]' object, as a
| literal value may not be specified as a target of an assignment,
| directly or indirectly though a pointer cast to a non-const object
| reference, unlike as a plain old 'const' objects may be.

But, a plain old 'const' object cannot be a target of an assignment.
There is no different there -- and certainly "static" does not imply a 
difference there -- so the basis of your argument seems fragile to
begin with.

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20475

Reply via email to