The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] origins of void* -- Apology!
@ 2017-11-07 15:34 Nelson H. F. Beebe
  2017-11-08 12:48 ` Tony Finch
  0 siblings, 1 reply; 31+ messages in thread
From: Nelson H. F. Beebe @ 2017-11-07 15:34 UTC (permalink / raw)


Arthur Krewat <krewat at kilonet.net> writes on Mon, 6 Nov 2017 19:34:34 -0500

>> char (at least these days) is signed. So really, it's 7-bit ASCII.

I decided last night to investigate that statement, and updated my
C/C++ features tool to test the sign and range of char and wchar_t.  

I ran it in our test lab with physical and virtual machines
representing many different GNU/Hurd, GNU/Linux, *BSD, macOS, Minix,
Solaris, and other Unix family members, on ARM, MIPS, PowerPC, SPARC,
x86, and x86-64 CPU architectures.  Here is a summary:

	% cat *.log | grep '^ char type is' | sort | uniq -c
	    157         char type is          signed
	      3         char type is          unsigned

The sole outliers are 

	* Arch Linux ARM on armv7l
	* IBM CentOS Linux release 7.4.1708 on PowerPC-8
	* SGI IRIX 6.5 on MIPS R10000-SC

for which I found these log data:

	Character range and sign...
		CHAR_MIN                        =   +0
		CHAR_MAX                        = +255
		SCHAR_MIN                       = -128
		SCHAR_MAX                       = +127
		UCHAR_MAX                       = +255
		char type is          unsigned
		signed char type is   signed
		unsigned char type is unsigned

The last two lines are expected, but my program checked for an
incorrect result, and would have produced the string "WRONG!" in the
output; no system had that result.

-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- University of Utah                    FAX: +1 801 581 4148                  -
- Department of Mathematics, 110 LCB    Internet e-mail: beebe at math.utah.edu  -
- 155 S 1400 E RM 233                       beebe at acm.org  beebe at computer.org -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 31+ messages in thread
* [TUHS] origins of void* -- Apology!
@ 2017-11-08 16:07 Nemo
  2017-11-08 16:12 ` Warner Losh
  0 siblings, 1 reply; 31+ messages in thread
From: Nemo @ 2017-11-08 16:07 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 390 bytes --]

On 6 November 2017 at 19:36, Ron Natalie <ron at ronnatalie.com> wrote:
> It’s worse than that.   “char” is defined as neither signed nor unsigned.
> The signedness is implementation defined.    This was why we have the inane
> “signed” keyword.

What was that story about porting an early UNIX to a machine with
different char polarity?  I dimly recall only a few problems.

N.


^ permalink raw reply	[flat|nested] 31+ messages in thread
* [TUHS] origins of void*
@ 2017-11-06 15:02 Warner Losh
  2017-11-06 21:46 ` [TUHS] origins of void* -- Apology! Steve Johnson
  0 siblings, 1 reply; 31+ messages in thread
From: Warner Losh @ 2017-11-06 15:02 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2097 bytes --]

On Mon, Nov 6, 2017 at 12:24 AM, <arnold at skeeve.com> wrote:

> Paul Ruizendaal <pnr at planet.nl> wrote:
>
> > >> In the 4BSD era there was caddr_t, which I think was used for pretty
> > >> much the same purposes.
> > >
> > > Only for kernel code. I am pretty sure caddr_t wasn't used in
> user-land code.
> >
> > Ah, thanks for pointing that out, I had not realised that and it helps
> > explain some things. But why wasn’t caddr_t used for user-land code:
> > usage in the signature of e.g. write() would have made sense, right?
>
> It's clear from K&R 1 that char* served as both pointer to string and
> generic pointer to memory.  That's not unreasonable, since, in some sense,
> "memory is just bytes".  So user-land code didn't need caddr_t.  I also
> suspect that caddr_t came into being with the effort to port Unix off
> the PDP-11 and the weight of Unix practice before then had been to make
> do with char*.
>
> I think it helps to remember the evolutionary processes that were happening
> in the '70s.  High level languages had caught on for application code
> (FORTRAN and COBOL in the US, Algol in Europe) but the weight of existing
> practice for *systems coding* (operating systems and utilities) had been
> to use assembly language.  Multics proved that you could write an OS in
> a high level language, but Multics itself (at that time) wasn't a success.
>
> So when C came along in the mid-'70s, strong typing had essentially been
> absent from systems programming.  With time and experience, along with
> the recognition in the general CS world that strong typing was valuable,
> C also started to evolve in that direction.
>

I thought there'd also been some influences from BLISS... DEC did much of
their system programming in BLISS along side the MACRO-{11,32,20}....  Not
exactly a strongly typed language, but another entry in the higher level
language category that C was competing against.

Warner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20171106/67775e3c/attachment.html>


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2017-11-09  7:44 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-07 15:34 [TUHS] origins of void* -- Apology! Nelson H. F. Beebe
2017-11-08 12:48 ` Tony Finch
2017-11-08 13:36   ` Otto Moerbeek
2017-11-08 16:03   ` Warner Losh
  -- strict thread matches above, loose matches on Subject: below --
2017-11-08 16:07 Nemo
2017-11-08 16:12 ` Warner Losh
2017-11-08 19:59   ` Ron Natalie
2017-11-08 23:33   ` Steffen Nurpmeso
2017-11-09  1:35   ` Steve Johnson
2017-11-06 15:02 [TUHS] origins of void* Warner Losh
2017-11-06 21:46 ` [TUHS] origins of void* -- Apology! Steve Johnson
2017-11-06 22:18   ` Warner Losh
2017-11-07  0:25   ` Ron Natalie
2017-11-07  0:34     ` Arthur Krewat
2017-11-07  0:36       ` Ron Natalie
2017-11-07  1:09     ` Bakul Shah
2017-11-07  1:55       ` Ron Natalie
2017-11-08 17:44       ` Ralph Corderoy
2017-11-08 19:56         ` Ron Natalie
2017-11-08 20:39           ` Don Hopkins
2017-11-08 20:42             ` Ron Natalie
2017-11-08 20:47               ` Don Hopkins
2017-11-08 20:48                 ` Don Hopkins
2017-11-08 20:43             ` Don Hopkins
2017-11-08 20:43             ` Clem Cole
2017-11-08 20:45             ` Warner Losh
2017-11-09  6:33               ` Lars Brinkhoff
2017-11-08 20:50           ` Steve Nickolas
2017-11-08 21:25         ` Bakul Shah
2017-11-09  6:37           ` Lars Brinkhoff
2017-11-09  7:14             ` Don Hopkins
2017-11-09  7:44               ` Lars Brinkhoff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).