9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Sape Mullender <sape@plan9.bell-labs.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] what's wrong with this?
Date: Fri, 27 Sep 2002 10:09:12 -0400	[thread overview]
Message-ID: <79dc8d5b2d0f6aaa2d6b20dabe37be4b@plan9.bell-labs.com> (raw)

> Dear friends,
>
> 8c complies "syntax error" when the following macro is called:
>
> #define	jpc_bitstream_getbit_macro(bitstream) \
> 	(assert((bitstream)->openmode_ & JPC_BITSTREAM_READ), \
> 	  (--(bitstream)->cnt_ >= 0) ? \
> 	  (((bitstream)->buf_ >> (bitstream)->cnt_) & 1) : \
> 	  jpc_bitstream_fillbuf(bitstream))
>
> int ret;
> ...
> ret=jpc_bitstream_getbit_macro(bitstream);

For starters, it's abhorrently awful code.  You're also using macros recursively.
Assert is a macro:
	#define	assert(x) if(x){}else _assert("x")
Substitute it in your code and behold the mess you get.

What are you trying to save with this macro anyway?

	Sape



             reply	other threads:[~2002-09-27 14:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-27 14:09 Sape Mullender [this message]
2002-10-07 13:53 ` peter a. cejchan
  -- strict thread matches above, loose matches on Subject: below --
2002-10-07 14:34 Russ Cox
2002-09-27 15:36 rog
2002-09-30  9:18 ` Douglas A. Gwyn
2002-09-27 14:28 Charles Forsyth
2002-09-30  9:17 ` Douglas A. Gwyn
2002-09-30  9:28 ` Ralph Corderoy
2002-09-27 14:12 Peter A. Cejchan
2002-09-27 14:05 Russ Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=79dc8d5b2d0f6aaa2d6b20dabe37be4b@plan9.bell-labs.com \
    --to=sape@plan9.bell-labs.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).