Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utcs!mnetor!seismo!columbia!caip!clyde!cbatt!cbosgd!danews!lvc From: lvc@danews.UUCP Newsgroups: net.lang.c Subject: Sizeof structure members Message-ID: <148@danews.UUCP> Date: Sat, 12-Jul-86 22:14:28 EDT Article-I.D.: danews.148 Posted: Sat Jul 12 22:14:28 1986 Date-Received: Sun, 13-Jul-86 10:17:44 EDT Distribution: net Organization: AT&T Bell Labs, Columbus OH Lines: 22 I recently wrote a program that made use of the utmp structure. I wanted to define a global character array of the same size as a member (ut_line) of utmp. Since the size is wired in as 12 and not #defined (which is what I would have done!), I decided to define the array as: char ftty[sizeof getutent()->ut_line]; I didn't want to define a global variable of type 'struct utmp *', because I didn't need it, and lint would complain because I didn't use it. I could declare an external variable of type 'struct utmp *', that I'd never use, but this seems just as bad as the unused global. Without getutent() (which is what could happen in similar situations) I believe I am stuck with either of the above 'solutions'. Does anyone know if I'm wrong about this ? I use Sys 5 Rel 2 Unix. Thanks, -- Larry Cipriani AT&T Network Systems danews!lvc "Nothing is worse than an itch you can never scratch."