|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Is there some suggestion about naming macro / naming function?
should macro name start with uppercase?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
hi,
"And" <49341109@ntnu.edu.tw> wrote:
> Is there some suggestion about naming macro / naming function?
>
> should macro name start with uppercase?
I'd better not get into the upper vs lowercase debate :-). but if you think the
code may be published in future, I'd recommend sticking with the conventions
enumerated in the Object Collection (which still is offline, for the time being)
documentation. Cousin Ricky posted a v good summary of "the rules", see section
'namespace compliance'; <http://news.povray.org/64014f55%40news.povray.org>.
regards, jr.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"And" <49341109@ntnu.edu.tw> wrote:
> should macro name start with uppercase?
Yes, I think so, to avoid collisions with the SDL
For macro's inside an include file I tend to prepend the name with a few
'meaningfull' capitals.
Macro's inside a Singly Linked List include look like
SLLInit()
SLLPush()
SLLAdd()
SLLPop()
SLLPeek()
....
For macro's and variables that are private to an include file I tend to prepend
them with an underscore.
ingo
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Le 2023-07-12 à 04:15, And a écrit :
> Is there some suggestion about naming macro / naming function?
>
> should macro name start with uppercase?
>
The name of macros and functions should contain an upper case character
to avoid any name collision with SDL's key words that are always all
lowercase.
The convention is to start with an uppercase character, but, it's up to you.
The suggestion from Ingo is a good one.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Alain Martel <kua### [at] videotronca> wrote:
> > Is there some suggestion about naming macro / naming function?
> >
> > should macro name start with uppercase?
> >
>
> The name of macros and functions should contain an upper case character
> to avoid any name collision with SDL's key words that are always all
> lowercase.
> The convention is to start with an uppercase character, but, it's up to you.
> The suggestion from Ingo is a good one.
Thank you.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"ingo" <nomail@nomail> wrote:
> "And" <49341109@ntnu.edu.tw> wrote:
> > should macro name start with uppercase?
>
> Yes, I think so, to avoid collisions with the SDL
>
> For macro's inside an include file I tend to prepend the name with a few
> 'meaningfull' capitals.
>
> Macro's inside a Singly Linked List include look like
> SLLInit()
> SLLPush()
> SLLAdd()
> SLLPop()
> SLLPeek()
> ....
>
> For macro's and variables that are private to an include file I tend to prepend
> them with an underscore.
>
> ingo
Is it a good idea offer only one (public using) macro in an include file?
I just see someone use two underscore __ to connect words, then use another one
underscore _ , I would like to know the occasion.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"jr" <cre### [at] gmailcom> wrote:
> hi,
>
> "And" <49341109@ntnu.edu.tw> wrote:
> > Is there some suggestion about naming macro / naming function?
> >
> > should macro name start with uppercase?
>
> I'd better not get into the upper vs lowercase debate :-). but if you think the
> code may be published in future, I'd recommend sticking with the conventions
> enumerated in the Object Collection (which still is offline, for the time being)
> documentation. Cousin Ricky posted a v good summary of "the rules", see section
> 'namespace compliance'; <http://news.povray.org/64014f55%40news.povray.org>.
>
>
> regards, jr.
Thank you. I happen to download some POV-Object-Collection written by Cousin
Ricky from Github yesterday.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
hi,
"And" <49341109@ntnu.edu.tw> wrote:
> ...
> Thank you. I happen to download some POV-Object-Collection written by Cousin
> Ricky from Github yesterday.
I think his sum-up is pretty comprehensive.
> I just see someone use two underscore __ to connect words ...
I have started doing this (too), used for internal-to-inc-file macros / names.
regards, jr.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Le 2023-07-13 à 00:03, And a écrit :
>
> Is it a good idea offer only one (public using) macro in an include file?
>
> I just see someone use two underscore __ to connect words, then use another one
> underscore _ , I would like to know the occasion.
>
There is no real reason to have only one macro per include. In fact, is
you look at the distribution, you'll find several includes that provide
several macros.
The good practice would be to bundle macros that are somewhat related.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thanks.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |