Re: Technical reason why sizeof() is an operator and not a function?
- From: Gerry Quinn <gerryq@xxxxxxxxxxxxxxxxxxx>
- Date: Tue, 17 Jan 2006 19:36:10 -0000
In article <dqit7c$7ab$1@xxxxxxxxxxxxxxxxxxxx>, kers@xxxxxxxxxx says...
> Gerry Quinn wrote:
>
> > int* ptr = malloc( 100 * sizeof( int ) );
>
> Too vulnerable to changes in the type of `ptr`. Shiver.
That's irrelevant to the question of whether sizeof should take
brackets.
That said, int pointers don't usually change. In C++ the equivalent
is:
int* ptr = new int[ 100 ];
...and that doesn't seem to bother anyone.
- Gerry Quinn
.
- Follow-Ups:
- Re: Technical reason why sizeof() is an operator and not a function?
- From: Chris Dollin
- Re: Technical reason why sizeof() is an operator and not a function?
- From: Alex Fraser
- Re: Technical reason why sizeof() is an operator and not a function?
- References:
- Technical reason why sizeof() is an operator and not a function?
- From: Chad
- Re: Technical reason why sizeof() is an operator and not a function?
- From: Peter Ammon
- Re: Technical reason why sizeof() is an operator and not a function?
- From: Gerry Quinn
- Re: Technical reason why sizeof() is an operator and not a function?
- From: Alex Fraser
- Re: Technical reason why sizeof() is an operator and not a function?
- From: Gerry Quinn
- Re: Technical reason why sizeof() is an operator and not a function?
- From: Chris Dollin
- Technical reason why sizeof() is an operator and not a function?
- Prev by Date: Re: C program to find RAM size?
- Next by Date: Newsgarbage user-controlled tech news site goes into beta!
- Previous by thread: Re: Technical reason why sizeof() is an operator and not a function?
- Next by thread: Re: Technical reason why sizeof() is an operator and not a function?
- Index(es):
Relevant Pages
|