Compiling GCC With a C++ Compiler (g++)

Geoffrey Keating geoffk@apple.com
Thu Oct 14 20:33:00 GMT 2004


On 14/10/2004, at 5:42 AM, Gabriel Dos Reis wrote:

> "Dave Korn" <dk@artimi.com> writes:
>
> |  Does this still make sense?  It's making my mind
> | boggle in several directions at once.
>
> I think there is a hole in the argument about allocating object
> with malloc().  The key is to understand what the effective type of
> the object is.

Why do you think the effective type has anything to do with it?  
Section 6.7.3 speaks only of "an object defined with a const-qualified 
type".  For that to be relevant, you must be able to point at a 
definition.  The word "definition" is defined in section 6.7 paragraph 
5:

> A definition of an identifier is a declaration for that identifier 
> that: —for an object, causes storage to be reserved for that object 
> ...

When malloc is used no identifier is declared, so no object allocated 
with malloc is ever 'defined'.  This is why things allocated with 
malloc do not have a scope, and do not go away at the next close-brace.

This is why it's important to realise that the effective type is not 
relevant here.  Objects allocated with malloc have an effective type, 
but they are not defined with a type.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2408 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20041014/f98e9cf7/attachment.p7s>


More information about the Gcc mailing list