Thread: coding style

  1. #1
    Registered User
    Join Date
    Sep 2001

    coding style

    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);

    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



    does anyone have any input?


    "THE DAY IS MYNE!!!!
    I'll take famouse titties for $400"
    -Sean Connery, Saturday Night Live

  2. #2
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Crossposting is bad for your health...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Is it bad style of coding ??
    By noobcpp in forum C++ Programming
    Replies: 15
    Last Post: 11-06-2008, 10:39 AM
  2. Your Coding Style?
    By Krak in forum A Brief History of
    Replies: 45
    Last Post: 06-02-2005, 08:19 AM
  3. Coding style?
    By Brian in forum A Brief History of
    Replies: 43
    Last Post: 10-22-2003, 11:26 AM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  5. Coding style
    By Clyde in forum A Brief History of
    Replies: 21
    Last Post: 04-09-2002, 04:22 PM