switch (expression)

e.a.olson eao at anumb.UUCP
Fri Jul 15 02:21:00 AEST 1988


In article <755 at vsi.UUCP> sullivan at vsi.UUCP (Michael T Sullivan) writes:
>In article <1988Jul12.105547.13268 at light.uucp>, bvs at 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.



More information about the Comp.std.c mailing list