Click here to Skip to main content
15,887,135 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Printing from a dialog based MFC application Pin
Nuri Ismail29-May-09 21:36
Nuri Ismail29-May-09 21:36 
Questiondice generation Pin
swtlibra29-May-09 18:01
swtlibra29-May-09 18:01 
QuestionRe: dice generation Pin
CPallini29-May-09 21:25
mveCPallini29-May-09 21:25 
AnswerRe: dice generation Pin
swtlibra29-May-09 21:36
swtlibra29-May-09 21:36 
QuestionRe: dice generation Pin
CPallini30-May-09 2:56
mveCPallini30-May-09 2:56 
AnswerRe: dice generation Pin
swtlibra30-May-09 23:42
swtlibra30-May-09 23:42 
GeneralRe: dice generation Pin
CPallini31-May-09 0:02
mveCPallini31-May-09 0:02 
QuestionThe peculiarities of reality : leaner but not faster ? Pin
GJBR29-May-09 10:30
GJBR29-May-09 10:30 
The weirdest thing :

compiling the following C code with gcc (no options) on linux64 :

int main ()<br />
{<br />
        unsigned int i,j ;<br />
        printf("start");<br />
        for (i=j=0;i < UINT_MAX ;i++);<br />
        printf("end");<br />
}<br />
<br />

produces a faster binary than this next (leaner) code :

int main ()<br />
{<br />
        unsigned int i ;<br />
        printf("start");<br />
        for (i=0;i < UINT_MAX ;i++);<br />
        printf("end");<br />
}


Can someone explain ??

The first code takes around 13-14 seconds on average to run on my machine (dual core AMD64)

the second code takes 14-15 seconds ,on average between 1-2 seconds slower Confused | :confused:

why would the addition of an extra int (namely j) produce faster code ?

Can you reproduce on your machine ? D'Oh! | :doh:
AnswerRe: The peculiarities of reality : leaner but not faster ? Pin
David Crow29-May-09 10:58
David Crow29-May-09 10:58 
GeneralRe: The peculiarities of reality : leaner but not faster ? Pin
GJBR29-May-09 11:10
GJBR29-May-09 11:10 
AnswerRe: The peculiarities of reality : leaner but not faster ? Pin
BobInNJ29-May-09 11:14
BobInNJ29-May-09 11:14 
GeneralRe: The peculiarities of reality : leaner but not faster ? Pin
GJBR29-May-09 11:42
GJBR29-May-09 11:42 
AnswerRe: The peculiarities of reality : leaner but not faster ? Pin
Stuart Dootson29-May-09 13:14
professionalStuart Dootson29-May-09 13:14 
AnswerRe: The peculiarities of reality : leaner but not faster ? Pin
Joe Woodbury29-May-09 13:29
professionalJoe Woodbury29-May-09 13:29 
AnswerRe: The peculiarities of reality : leaner but not faster ? Pin
Luc Pattyn29-May-09 13:40
sitebuilderLuc Pattyn29-May-09 13:40 
Questionimage in picture control not displayed properly after moving Pin
dumnbncool29-May-09 10:06
dumnbncool29-May-09 10:06 
Questionurgent help Pin
ramina sen29-May-09 8:18
ramina sen29-May-09 8:18 
AnswerRe: urgent help Pin
David Crow29-May-09 8:28
David Crow29-May-09 8:28 
GeneralRe: urgent help Pin
ramina sen29-May-09 8:33
ramina sen29-May-09 8:33 
GeneralRe: urgent help Pin
Cedric Moonen29-May-09 8:51
Cedric Moonen29-May-09 8:51 
GeneralRe: urgent help Pin
CPallini29-May-09 8:58
mveCPallini29-May-09 8:58 
GeneralRe: urgent help Pin
krmed29-May-09 10:17
krmed29-May-09 10:17 
RantRe: urgent help Pin
Michael Schubert29-May-09 12:43
Michael Schubert29-May-09 12:43 
GeneralRe: urgent help Pin
Jim Crafton29-May-09 8:38
Jim Crafton29-May-09 8:38 
AnswerRe: urgent help Pin
Wes Aday29-May-09 9:22
professionalWes Aday29-May-09 9:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.