Path: utzoo!utgpu!water!watmath!clyde!att!whuts!homxb!genesis!hotlr!anumb!eao From: eao@anumb.UUCP (e.a.olson) Newsgroups: comp.std.c Subject: Re: switch (expression) Message-ID: <287@anumb.UUCP> Date: 14 Jul 88 16:21:00 GMT References: <1988Jul12.105547.13268@light.uucp> <755@vsi.UUCP> Reply-To: eao@anumb.UUCP (e.a.olson) Organization: AT&T Bell Laboratories - MV Lines: 20 In article <755@vsi.UUCP> sullivan@vsi.UUCP (Michael T Sullivan) writes: >In article <1988Jul12.105547.13268@light.uucp>, bvs@light.uucp (Bakul Shah) writes: >I don't know about casting should be avoided. I'm looking at shmop(2) manual >page for our 3B2 (shared memory operation) and it says: ... > Otherwise, a value of -1 is returned and errno is set to indicate > the error." > >Somebody at AT&T must think casting a pointer to an int (or a long) isn't >such a bad idea, unless I'm missing something (it has been known to happen). I think that this might be due more to the convention that all section 2 calls return a -1 for error (and the fact that shmop feels that zero is fine to return) than to anything to do with how AT&T feels about casting a pointer to an int. In any case, as long as the system call and the caller share the same machine, and both the system call and the caller cast from a pointer to an int (or a long), then whatever -1 happens to be, both will agree on its value.