Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!yale!slb-sdr!saito From: saito@slb-sdr.UUCP (Naoki Saito) Newsgroups: comp.lang.c Subject: How to discriminate the structures? Message-ID: <420@slb-sdr.UUCP> Date: Wed, 2-Dec-87 16:13:35 EST Article-I.D.: slb-sdr.420 Posted: Wed Dec 2 16:13:35 1987 Date-Received: Sun, 6-Dec-87 08:39:18 EST Organization: Schlumberger-Doll Research, Ridgefield, CT Lines: 32 Keywords: structure, typeof() A few weeks ago, there was a discussion on typeof() on this news group. I would like to use typeof() if someone has a code of that. What I want to do is to discriminate type of the structured variables. For example, typedef struct { float x; float y; } POINT; typedef struct { float r; float theta; } POINTR; foo(point) caddr_t *point; /* In fact, I don't know how to declare point here. */ /* caddr_t is "character address type" used in Sun. */ { if (typeof(*point) == POINT) { do something...} else if (typeof(*point) == POINTR) { do something...} } Could someone out there give me some suggestion/advise? Thanks in advance. Naoki Saito (saito%slb.sdr.com) Schlumberger-Doll Research