Date: Thu, 31 May 2001 07:43:04 -0700 From: Don Dugger <dugger@hotlz.com> To: j mckitrick <jcm@FreeBSD-uk.eu.org> Cc: freebsd-questions@freebsd.org Subject: Re: what's wrong with this macro? Message-ID: <3B165878.E61B3574@hotlz.com> References: <20010531143315.A83651@dogma.freebsd-uk.eu.org> <3B164FDD.B59D380A@hotlz.com> <20010531151330.A84734@dogma.freebsd-uk.eu.org> <3B165467.9B71982@hotlz.com> <20010531153311.A85342@dogma.freebsd-uk.eu.org>
next in thread | previous in thread | raw e-mail | index | archive | help
There are some very important differences. Notice the "do" in front of the "{". This defines the block as a "do while" block in the other case it was just a block which is fine in C++ but not in C. Don 8) j mckitrick wrote: > > | you may need to change the CXX or CC to g++ or gcc. Normally this is > | somewhere in the top of the Makefile. > > And yet *this* excerpt compiles fine: > > dogma:~> cat grr2.c > #define Q_COMMAND_1(a, b) do { \ > q_command[0] = '\0'; \ > strcat(q_command, QUANTUM_PROLOGUE); \ > strcat(q_command, a); \ > strcat(q_command, b); \ > strcat(q_command, QUANTUM_EPILOGUE); \ > } while(0) > > dogma:~> cc grr2.c > /usr/lib/crt1.o: In function `_start': > /usr/lib/crt1.o(.text+0x79): undefined reference to `main' > dogma:~> > > jcm > -- > "I drank WHAT ?!" - Socrates To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3B165878.E61B3574>