Jump to content

names of user defined functions

- - - - -

  • Please log in to reply
3 replies to this topic

#1
jackson6612

jackson6612

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 304 posts
Hi

1: Do we need to follow the same rules for function names as for the variables?

2: I have always noticed there is no space between the function name and the parentheses, e.g. func(). But I have just experimented and found that having a space between the function name and parentheses doesn't make a difference. Correct? Perhaps, it's considered non-standard.

Please help me with the above queries. Thanks.
I'm an outright beginner, learning C++. Using Win XP Pro and Code::Blocks. Be nice to me, please.:)

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
There are absolutely no rules for naming with valid names, only informal guidelines. You may wish to review some of them here:
Indent style - Wikipedia, the free encyclopedia

You will notice the GNU style tries to place a space between names and the parentheses as you have tried, i.e func (). It is all about how you represent your code, you can certainly use a single style (trying to keep it all one style), although if you contribute to a code or project such as helping somebody online here, you may wish to adopt their style to keep things normalized. Multiple coding styles can get messy fast.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
The rules for a valid identifier are the same for function names as variables (you can't use a number for the first character, which characters are valid, etc).
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#4
jackson6612

jackson6612

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 304 posts
Thank you, Alexander.

I have always tried to figure out the thing the person carrying on his shoulder in your avatar!

Regards
Jackson
I'm an outright beginner, learning C++. Using Win XP Pro and Code::Blocks. Be nice to me, please.:)




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users