Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!uflorida!haven!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.os.minix Subject: Re: Minix/ST problems. Message-ID: <14113@mimsy.UUCP> Date: 22 Oct 88 16:33:16 GMT References: <249@cstw01.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 42 In article <249@cstw01.UUCP> meulenbr@cstw01.UUCP (Frans Meulenbroeks) writes: >I've encountered a number of problems using Minix/ST . >The major problem is that it defines NULL as 0. >This is a killer on an ST since sizeof(char *) == 32 and sizeof(int) == 16. >Solution: change the 0 in (char *)0 Do NOT do this. In the absence of `void *' as a type, the only two correct and realistic ways to define NULL are `0' and `0L'. (If you read the draft ANSI C standard, you should see why I say this.) Instead, be sure to cast NULL whenever it is used as an argument to a function. >Some other problems are encountered when a program tries to access the >private part of a FILE struct . . . . Not surprising; you are not supposed to do this, but people will do all sorts of things.... >A side note: don't expect that _doprintf uses the parameter order you're >used to. It doesn't. Of course decent programs don't call _doprintf >directly (but dirty ones like the curses lib do. Curses should use vsprintf. vsprintf is like sprintf but gets a `va_list' argument, i.e., a pointer into the call stack, and vsprintf is basically a wrapper for the internal printf routine---sprintf is a bit more than a wrapper since it provides the call stack to which the va_list pointer will point. (Actually, curses should use a more general stdio, but this may be more than Minix needs as yet. Stdio currently calls read, write, lseek, and close on open FILEs. Rather than calling read, write, lseek, and close directly, it should call `a read routine', `a write routine', `a seek routine', and `a close routine'. Normally these would be the same ones, but another routine would `open' four functions rather than a file descriptor. Curses would then use this to `open' a curses window for writing, where the write function would put characters to the window. Then there are no magic buffer size limits like `no more than 127 characters printed at a time'. Note that the various routines must be given an argument so that, e.g., a curses window writer can tell to which window to print. My approach was to allow one pointer argument.) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris