Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] build issues

Date2007-05-03 15:42
FromMichael Gogins
SubjectRe: [Cs-dev] build issues
I suggest using an enum or a constant static variable instead of a macro.

Regards,
Mike

-----Original Message-----
>From: Steven Yi 
>Sent: May 3, 2007 10:24 AM
>To: Developer discussions 
>Subject: Re: [Cs-dev] build issues
>
>Hi All,
>
>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.
>
>However, I also agree with Michael that macros can be very problematic
>for most of the reasons he cited, but only when it is used as
>shorthand for a body of code and not when used to name constants.  (It
>is one of the reasons I recommend to Csound users to use User-Defined
>opcodes instead of macro's).  If C macro's worked safely like Guile's
>hygenic macro system (which I find incredibly elegant) it'd be great
>to use, but since it is just text replacement it can cause the
>problems mentioned by MIchael.
>
>Regarding Richard's observation about 0 not always being false, I find
>that in those cases 0 is often defined as SUCCESS and other values
>defined ase some kind of FAILURE or something like that, rather than
>FALSE/TRUE.
>
>steven
>
>
>On 5/1/07, jpff  wrote:
>> OK since we are playing these games, I have earned my living
>> programming for 36 years, and have been full-time programming for 40.
>> I disagree.  Indeed I was berating students last week for bare 1000
>> and 92 in their compilers when they meant HASHSIZE or the like.  I
>> have also taught COBOL where the use of names for constants is
>> important.
>>   Anyway, I like macros.
>> ==John ffitch
>>
>> -------------------------------------------------------------------------
>> 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
>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

Date2007-05-03 17:57
From"Steven Yi"
SubjectRe: [Cs-dev] build issues
AttachmentsNone  

Date2007-05-03 23:09
Fromjpff
SubjectRe: [Cs-dev] build issues
But there are no methods in C (to quote my remarks on student compilers)
==John ffitch
> That leads me to wonder too would replacing macro's that are bodies of
> code with inline methods be equivalent after compilation?

-------------------------------------------------------------------------
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

Date2007-05-04 03:45
From"Steven Yi"
SubjectRe: [Cs-dev] build issues
AttachmentsNone  

Date2007-05-04 15:40
FromAnthony Kozar
SubjectRe: [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