Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!elroy.jpl.nasa.gov!ames!pacbell!att!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.lang.c Subject: Re: struct accessing Message-ID: <8869@chinet.chi.il.us> Date: 5 Jul 89 20:40:51 GMT References: <1545@stl.stc.co.uk> <470002@gore.com> <1411@garcon.cso.uiuc.edu> <18255@usc.edu> Reply-To: les@chinet.chi.il.us (Leslie Mikesell) Organization: Chinet - Public Access Unix Lines: 16 In article <18255@usc.edu> blarson@basil.usc.edu (bob larson) writes: >>There is a special dispensation, though: "If a pointer to a structure >>is cast to the type of a pointer to its first member, the result >>refers to the first member". [8.3] >There is at least one current (non-ansi) compiler that does not do this >currently... Is it possible to use the bsearch(), tsearch(), etc., library routines for data in structs if a pointer to the struct cannot be cast to a character pointer? Alternatively, given a pointer to an element of a struct, is it possible to deduce the base address (I assume this would require pointer subtraction and thus be illegal)? Les Mikesell