🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Steve Harris Wed, 26 Mar 1986 23:57
Bug in putc
#516
Author: Steve Harris
Date: Wed, 26 Mar 1986 23:57
13 lines
1199 bytes
There is a bug in the putc macro, in stdio.h.
Putc returns an int which contains the char you have just "put".
However, (at least on both a Pixel and a Sun), the result is sign extended;
if the 8th bit of the char is set, the return value from putc does not equal
the character you put!  To fix, replace the putc macro with the following:

#define putc(x,p) ((int) ((--(p)->_cnt>=0? ((unsigned char)(*(p)->_ptr++=(x))):(unsigned char)_flsbuf((x),p))))
-- 

Steve Harris            |  {allegra|ihnp4|cbosgd|ima|genrad|amd|harvard}\
xePIX, Inc.             |               !wjh12!pixel!pixdoc!vsh
51 Lake Street          |
Nashua, NH  03060       |  +1 603 881 8791
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads