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.
3 replies to this topic
#1
Posted 14 May 2011 - 01:53 PM
I'm an outright beginner, learning C++. Using Win XP Pro and Code::Blocks. Be nice to me, please.:)
|
|
|
#2
Posted 14 May 2011 - 02:03 PM
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.
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.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#3
Posted 14 May 2011 - 02:07 PM
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).
#4
Posted 14 May 2011 - 02:07 PM
Thank you, Alexander.
I have always tried to figure out the thing the person carrying on his shoulder in your avatar!
Regards
Jackson
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


Sign In
Create Account


Back to top









