Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!rochester!quiroz From: quiroz@cs.rochester.edu (Cesar Quiroz) Newsgroups: comp.lang.c Subject: Re: sizeof of struct field Message-ID: <1989Oct26.220406.19582@cs.rochester.edu> Date: 26 Oct 89 22:04:06 GMT Reply-To: quiroz@cs.rochester.edu (Cesar Quiroz) Organization: U of Rochester, Dept. of Computer Science, Rochester, NY 14627 Lines: 35 Summary: what is broken that needs so badly a fix? Under what conditions do you have (1) access to the name of a struct, (2) not an instance of the struct around ? I cannot come up with an example where I would need sizeof of a field, and not have an instance around. That, of course, is not an argument. But, if it never happens, then there is no problem to be fixed. For the most part, I can imagine: #include struct foo * make_foo(...) { struct foo result = (struct foo *) malloc(sizeof(struct foo)); ... /* here I can use sizeof(result->slot) */ } foobar use_foo(struct foo one,...) { /* here I can use sizeof(one.slot) */ } So, when would `sizeof( ((struct foo *)0)->slot )' be useful and not one of the cases above be available? -- Cesar Augusto Quiroz Gonzalez Department of Computer Science University of Rochester Rochester, NY 14627