Article View: comp.sys.mac
Article #23653Re: LSC comma operator
From: Matt Dillon
Date: Sat, 16 Jan 1988 03:41
Date: Sat, 16 Jan 1988 03:41
17 lines
981 bytes
981 bytes
I don't know about LSC, but the C comma operator returns the LAST
element in the list. BUT you have to be careful when you use it in macros.
always surround the whole thing with parenthesis so the priorities don't
get switched around in usage. You should always put parenthesis around macro
arguments when applicable. Imagine what would happen if there were none in
the following example:
#define blah(charlie) (ben,4-(charlie))
printf("test %ld\n", blah(a+b))
with no parenthesis, (1) you would getr 4-a+b instead of 4-(a+b), and
(2) printf would think it's two arguments instead of one. This may
be part of your problem.
-Matt
Technical Details
Message-ID:
<8801160341.AA11264@cory.Berkeley.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!cbosgd!ucbvax!CORY.BERKELEY.EDU!dillonShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!cbosgd!ucbvax!CORY.BERKELEY.EDU!dillon From: dillon@CORY.BERKELEY.EDU (Matt Dillon) Newsgroups: comp.sys.mac Subject: Re: LSC comma operator Message-ID: <8801160341.AA11264@cory.Berkeley.EDU> Date: 16 Jan 88 03:41:19 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 17