develooper Front page | perl.perl6.internals | Postings from January 2002

Re: Proposal: Naming conventions

Thread Previous | Thread Next
From:
Melvin Smith
Date:
January 10, 2002 18:57
Subject:
Re: Proposal: Naming conventions
Message ID:
5.1.0.14.0.20020110214608.00a96c10@pop.mindspring.com
At 11:34 PM 1/10/2002 +0000, Tom Hughes wrote:
>In message <20020110201559$7459@gosford.compton.nu>
>           "Melvin Smith" <melvins@us.ibm.com> wrote:
>
>Well sizeof(Foo) and sizeof(*foo) are not actually the same thing
>at all there because Foo is presumably a typedef for a pointer type
>so sizeof(Foo) will be the size of a pointer and sizeof(*foo) will
>be the size of the thing it points to.

Right, I misread the code snippet in my infinite confusion.

>In general it is safer to sizeof() on the variable you are working
>with than on it's type, as that way the sizeof() will still work if
>somebody changes the type of the variable.

Well even after misreading the snippet the point I was
getting at was emulating virtual pointers in C++ where the
allocator might create an object regardless of what type of
pointer it was using or assigning to. For example in the case
where an allocator had in it a switch statement of subclasses.

In the end this is more the exception than the rule and I see
I was just on a tangent. :)

>The type of *foo is whatever Foo as been typedefed as a pointer
>to, and FooBar is a red herring.

Grin, I'll read more carefully before arguing next time. ;)

-Melvin


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About