mbp@LAKISIS.UMD.EDU ("Mark Phillips ", RD Goldman) (09/18/88)
I have two questions regarding C standards: (1) Where can I find ANSI documents containing the current (if any) and proposed standards? Are they published in a book or journal? (2) Is it considered acceptable to do the following things with structures or unions? (a) pass them (by value) to functions (b) have functions which return them (c) assign them (=) (d) test them (structures only) for equality with == By "acceptable" I mostly mean "portable". The C compilers which I currently use (Sun OS and MS) allow at least (a),(b), and (c), but I am wondering whether I might run into problems porting my programs to other machines in the future if I do these things. Thanks! Mark Phillips Department of Mathematics University of Maryland College Park, Maryland
henry@utzoo.uucp (Henry Spencer) (09/21/88)
In article <8809171754.AA02615@lakisis.umd.edu> mbp@LAKISIS.UMD.EDU ("Mark Phillips ", RD Goldman) writes: >(1) Where can I find ANSI documents containing the current (if any) > and proposed standards? Are they published in a book or journal? Global Engineering Documents (714)261-1455 should be willing to sell you the third-public-review draft. Said public review is over, but there was an intent that it make only editorial changes and leave the content alone. Assuming that no disasters surface, the results of the review should become a real live ANSI standard in the not-too-distant future. At that point it will become possible to buy the thing from ANSI in Washington. Neither Global nor ANSI is a particularly cheap source of paper, by the way. >(2) Is it considered acceptable to do the following things with > structures or unions? > (a) pass them (by value) to functions > (b) have functions which return them > (c) assign them (=) These are all proper and legitimate constructs, and have been for quite a while. > (d) test them (structures only) for equality with == No. This was proposed to X3J11, I believe, but it was not accepted. > .... I am wondering whether I might run into problems > porting my programs to other machines in the future if I do > these things. There is no limit to how stupid compiler writers can be if given the chance, but any compiler which doesn't implement struct passing, returning, and assignment is seriously broken. I.e., there is no way to be sure that you won't someday end up dealing with a broken compiler, but there will be no serious debate about whether it is broken or not. -- NASA is into artificial | Henry Spencer at U of Toronto Zoology stupidity. - Jerry Pournelle | uunet!attcan!utzoo!henry henry@zoo.toronto.edu
will.summers@p6.f18.n114.z1.fidonet.org (will summers) (09/21/88)
In article <8809171754.AA02615@lakisis.umd.edu> mbp@LAKISIS.UMD.EDU ("Mark Phillips ", RD Goldman) writes: > > I have two questions regarding C standards: > > (2) Is it considered acceptable to do the following things with > structures or unions? > (a) pass them (by value) to functions > (b) have functions which return them > (c) assign them (=) Yes. > (d) test them (structures only) for equality with == Don't think so. Problem is "holes" that might have been left for alignment purposes. > Thanks! Yawelcome! \/\/ill -- St. Joseph's Hospital/Medical Center - Usenet <=> FidoNet Gateway Uucp: ...{gatech,ames,rutgers}!ncar!noao!asuvax!stjhmc!18.6!will.summers
pjh@mccc.UUCP (Pete Holsberg) (09/25/88)
What does dpANSI have as the set of conversion characters for scanf() and printf()? Does it match that in the latest Harbison & Steele. What about E, F, G, X, D, U, etc.? Thanks. Pete Holsberg UUCP: {...!rutgers!}princeton!mccc!pjh Technology Division ...!att!jonlab!mccc!pjh Mercer College CompuServe: 70240,334 1200 Old Trenton Road GEnie: PJHOLSBERG Trenton, NJ 08690 Voice: 1-609-586-4800