From owner-freebsd-questions Thu May 31 7:44:27 2001 Delivered-To: freebsd-questions@freebsd.org Received: from liberty.local.hotlz.com (freedom.hotlz.com [209.20.218.52]) by hub.freebsd.org (Postfix) with ESMTP id 152C237B42C for ; Thu, 31 May 2001 07:44:25 -0700 (PDT) (envelope-from dugger@hotlz.com) Received: from hotlz.com (liberty.local.hotlz.com [172.27.240.35]) by liberty.local.hotlz.com (8.9.3/8.9.3) with ESMTP id HAA49040; Thu, 31 May 2001 07:43:04 -0700 (PDT) (envelope-from dugger@hotlz.com) Message-ID: <3B165878.E61B3574@hotlz.com> Date: Thu, 31 May 2001 07:43:04 -0700 From: Don Dugger X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 3.4-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: j mckitrick Cc: freebsd-questions@freebsd.org Subject: Re: what's wrong with this macro? 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> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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