Re: [Newbie] What is sizeof() ?
From: Christian Bau (christian.bau_at_cbau.freeserve.co.uk)
Date: 10/31/03
- Next message: Rouben Rostamian: "casting"
- Previous message: Christian Bau: "Re: Pointers and Arrays in C??"
- In reply to: Peter Pichler: "Re: [Newbie] What is sizeof() ?"
- Next in thread: Peter Pichler: "Re: [Newbie] What is sizeof() ?"
- Reply: Peter Pichler: "Re: [Newbie] What is sizeof() ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 31 Oct 2003 01:01:44 +0000
In article <11iob.922$eV1.240@newsfep1-gui.server.ntli.net>,
"Peter Pichler" <pichlo6@pobox.sk> wrote:
> "Vincent Pierroux" <VPierroux@cybernet.be.SPAM> wrote in message
> news:3fa17e49$1_8@corp.newsgroups.com...
> > So, if it is a operator i don't have any argument push on the stack like a
> > function.
> >
> > If i make onething like that
> >
> > for(foo=0;foo<1000;i++)
> > foo+= sizeof myStruct ;
> >
> > it take the same processing time this
> >
> > var= sizeof myStruct
> > for(foo=0;foo<1000;i++)
> > foo+= var;
>
> Most likely the first one will take shorter: sizeof myStruct is a constant,
> so the compiler might just replace the whole loop with
>
> foo += 1000 * sizeof myStruct;
>
> On the other hand, so it could in the second case, should it be clever
> enough.
You mean stupid enough? Take a very good look at the for loop. It is
most likely _not_ executed 1000 times.
- Next message: Rouben Rostamian: "casting"
- Previous message: Christian Bau: "Re: Pointers and Arrays in C??"
- In reply to: Peter Pichler: "Re: [Newbie] What is sizeof() ?"
- Next in thread: Peter Pichler: "Re: [Newbie] What is sizeof() ?"
- Reply: Peter Pichler: "Re: [Newbie] What is sizeof() ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|