Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] build issues

Date2007-05-04 17:25
FromMichael Gogins
SubjectRe: [Cs-dev] build issues
Once again, this is why I prefer to not use macros or enums for things like this, just use 0 or 1 and let the semantics hang. Let the compiler do its thing without interference.

However, the usual solution, for those who prefer semantics, is to prefix with a namespace in some way. For a macro, CS_TRUE (better yet, CSOUND_TRUE) would not conflict with some other macro (or enum) for TRUE. Similarly, an enum CSOUND_TRUE or cs::true would not conflict with some other enum (or macro).

Regards,
Mike

-----Original Message-----
>From: Anthony Kozar 
>Sent: May 4, 2007 10:40 AM
>To: Csound Developer list 
>Subject: Re: [Cs-dev] build issues
>
>I am just wondering if putting this in a publicly-lncluded header is going
>to cause more problems in the long run.  If we define TRUE and FALSE as an
>enum, and a user of the API defines them as macros ...  Sure, we could
>macro-guard the enum definition, but it still seems "messy."
>
>Does anyone know for sure that it could be done as an enum safely?
>
>Anthony
>(who is tired of discussing this issue :)
>
>Michael Gogins wrote on 5/3/07 10:42 AM:
>
>> I suggest using an enum or a constant static variable instead of a macro.
>
>>> I agree with John regarding giving names to constants, and find that
>>> using macros for TRUE and FALSE when coding in C to be completely
>>> logical since there is no true and false built into the language.  I
>>> would rather like having a TRUE and FALSE globally defined for csound
>>> in csoundCore.h with an #ifdef.
>
>
>-------------------------------------------------------------------------
>This SF.net email is sponsored by DB2 Express
>Download DB2 Express C - the FREE version of DB2 express and take
>control of your XML. No limits. Just data. Click to get it now.
>http://sourceforge.net/powerbar/db2/
>_______________________________________________
>Csound-devel mailing list
>Csound-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/csound-devel




-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net