larson@snmp.sri.com (Alan Larson) (04/24/91)
Recently I have tried converting a program to use Think C version 4. I have discovered an interesting set of problems: 1. Some routines from the old stdio package are gone, such as kbhit(), apparently leaving no way to determine if a key has been hit. As it is desirable to be able interrupt a running program, this is annoying. Button() doesn't work very well when the program is doing a lot of output to the screen. 2. The external variable _echo is gone. 3. The strncmp routine now wants a long (actually size_t) as its third argument. This makes it especially difficult to write programs that will port easily to and from unix systems, where that variable is still an int. This would be less of a problem if the compiler did the type conversion, but it doesn't. I know the concepts of standards is good, but why did you have to break unix-compatable programs, and not offer a compatable library? Alan
hanche@imf.unit.no (Harald Hanche-Olsen) (04/24/91)
Alan Larson wrote: 3. The strncmp routine now wants a long (actually size_t) as its third argument. This makes it especially difficult to write programs that will port easily to and from unix systems, where that variable is still an int. This would be less of a problem if the compiler did the type conversion, but it doesn't. No? Well if you make sure that a function prototype is present (presumably bu #include'ing the relevant file) then type conversion should occur. - Harald Hanche-Olsen <hanche@imf.unit.no> Division of Mathematical Sciences The Norwegian Institute of Technology N-7034 Trondheim, NORWAY
guido@cwi.nl (Guido van Rossum) (04/25/91)
larson@snmp.sri.com (Alan Larson) writes: > Recently I have tried converting a program to use Think C version >4. I have discovered an interesting set of problems: > 1. Some routines from the old stdio package are gone, such > as kbhit(), apparently leaving no way to determine if > a key has been hit. > As it is desirable to be able interrupt a running program, > this is annoying. Button() doesn't work very well when > the program is doing a lot of output to the screen. If all you want is interrupting a program, you can use a signal handler. These are checked when the program prints any output to the console and when it waits for console input. Bonus: this is Unix compatible (if you are careful). > 3. The strncmp routine now wants a long (actually size_t) > as its third argument. This makes it especially difficult > to write programs that will port easily to and from unix > systems, where that variable is still an int. This would > be less of a problem if the compiler did the type conversion, > but it doesn't. If you #include <string.h>, the compiler will do the conversions for you, based upon the prototype. --Guido van Rossum, CWI, Amsterdam <guido@cwi.nl> Honary Member, Royal Society for Putting Things on Top of Other Things