Re: rvalue
From: Keith Thompson (kst-u_at_mib.org)
Date: 04/09/04
- Next message: J Wang: "about ## in ANSI C"
- Previous message: Rob Thorpe: "Re: rvalue"
- In reply to: Tobias Oed: "rvalue"
- Next in thread: Christopher Benson-Manica: "Re: rvalue"
- Reply: Christopher Benson-Manica: "Re: rvalue"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 09 Apr 2004 05:55:54 GMT
Tobias Oed <tobias@physics.odu.edu> writes:
> Hi all, It's been a while!
> I'm working on a very buggy piece of code that uses a lot of macros.
> A bunch of them look like
> #define POSITION(mw,row) (mw.positions[row])
> In order to debug the thing I'd like to modify these macors so they
> can only be used as rvalues and not as lvalues. If they are used as
> lvalues I want my compililation to fail. Unfortunately I can't
> remember a nice way to do that.
Assuming the result is numeric, I think this will work.
#define POSITION(mw,row) (+mw.positions[row])
I usually prefer to enclose all reference to macro arguments in
parentheses to avoid operator precedence problems, but I don't *think*
it's necessary in this case (though it won't hurt to do it anyway).
-- Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst> San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst> Schroedinger does Shakespeare: "To be *and* not to be"
- Next message: J Wang: "about ## in ANSI C"
- Previous message: Rob Thorpe: "Re: rvalue"
- In reply to: Tobias Oed: "rvalue"
- Next in thread: Christopher Benson-Manica: "Re: rvalue"
- Reply: Christopher Benson-Manica: "Re: rvalue"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|