Results 1 to 3 of 3

Thread: naming conventions underscore

  1. #1

    Thread Starter
    Lively Member FantastichenEin's Avatar
    Join Date
    Mar 2000
    Location
    dairy
    Posts
    106

    naming conventions underscore

    what is an underscore before a function name used to signify.
    e.g. _toupper()

    also what does it mean when a function name is preceded by 2 underscores.
    __functionName()

    thanks
    ****

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Having a _ prepended is reserved for internals to the Standard Library, I think. More than one is reserved for compiler vendors (I think MS use three in some cases ).

    Basically, you're not supposed to use them in your code.

    However, in C, all functions have a _ prepended internally (which is why if you don't get your linker settings right, you may get errors about _main()).
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    One underscore is for library internals or for compiler-specific extensions (like _itoa). gcc does not heed this because of POSIX requirements and similar things.

    __ is usually for compiler-specific keywords (like __gc, __int64, __declspec etc.). I actually don't know any functions that start with __
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width