Article View: net.lang.c
Article #9403Re: Orphaned Response
From: karl
Date: Tue, 16 Sep 1986 23:20
Date: Tue, 16 Sep 1986 23:20
27 lines
2027 bytes
2027 bytes
hadron!jsdy (Joe Yao) writes:
>In article <1761@mmintl.UUCP> franka@mmintl.UUCP (Frank Adams) writes:
>>[haddock!karl (Karl Heuer) writes:]
>>>For another, the types might be
>>>unknown, if they are arguments in a macro; in this case I would want the
>>>macro to work on void as well as valued expressions.
>>This case is not covered by my suggestion. I find it hard to imagine doing
>>it, however.
>When would one try to pass a void "value" to anything, whether or
>not it is a macro? (I agree, that is v e r y hard to imagine!)
Your comment "whether or not it is a macro" suggests that you are assuming
the macro has function semantics, in which case it would not be useful to
hand it a void expression. But not all macros have this property; consider
#define new(T) ((T *)malloc(sizeof(T)))
which expects a type rather than an expression.
What I was thinking of (I don't have a specific instance) was a macro whose
return value has the same type as its arguments -- like generic MIN and MAX.
To concoct something that would accept void arguments, you could write
#define foo(e1,e2) (SOMETHING ? (SOMETHING,(e1)) : (SOMETHING,(e2)))
I suppose. Of course, the user must be aware that this is a macro, and that
its value is void when its arguments are. In any case, I agree that it's
not all that likely, but it's not inconceivable.
Karl W. Z. Heuer (ima!haddock!karl; karl@haddock.isc.com), The Walking Lint
Technical Details
Message-ID:
<86900055@haddock>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!princeton!caip!im4u!ut-sally!husc6!panda!genrad!decvax!ima!haddock!karlReferences:
<559@hadron.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!princeton!caip!im4u!ut-sally!husc6!panda!genrad!decvax!ima!haddock!karl From: karl@haddock Newsgroups: net.lang.c Subject: Re: Orphaned Response Message-ID: <86900055@haddock> Date: Tue, 16-Sep-86 19:20:00 EDT Article-I.D.: haddock.86900055 Posted: Tue Sep 16 19:20:00 1986 Date-Received: Sat, 27-Sep-86 13:34:20 EDT References: <559@hadron.UUCP> Lines: 27 Nf-ID: #R:hadron.UUCP:559:haddock:86900055:000:1427 Nf-From: haddock!karl Sep 16 19:20:00 1986