PDA

View Full Version : coding style



ActionMan
10-03-2001, 07:29 AM
Hey all

been thinking about this a bit reciently.
which of the following would run faster??
------------------------------------------------
printf("Hello World");
-----------------------------------------------


-----------------------------------------------
char * string = "Hello World";
printf("%s", string);
-----------------------------------------------

or
-----------------------------------------------
printf("%s","Hello World");
-----------------------------------------------

I dont particularly want to know for the printf function, but functions in general.. (printf is prob a bad example)

I sometimes find it easier to read the code if it uses the 2nd style..
I figure that once the code is compiled it wouldnt make a difference.

Ive heard that the second style can make it easier for the compiler to compile code, which means the executable would be that little bit faster, Especially if your sending the return value from a function directly into that function:
.. hmm not to good at explainging so heres an example

----------------------------------------------------------------------
func2(func1());

----------------------------------------------------------------------

does anyone have any input?

cheers,

Govtcheez
10-03-2001, 07:36 AM
Crossposting is bad for your health...