The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] origins of void*
@ 2017-11-04 10:19 Paul Ruizendaal
  2017-11-05  9:48 ` Clem Cole
  2017-11-05 10:06 ` arnold
  0 siblings, 2 replies; 48+ messages in thread
From: Paul Ruizendaal @ 2017-11-04 10:19 UTC (permalink / raw)


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


I’m trying to understand the origins of void pointers in C. I think they first appeared formally in the C89 spec, but may have existed in earlier compilers.

Of course, as late as V7 there wasn’t much enforcement of types and hence no need for the void* concept and automatic casting. I suppose ‘lint’ would have flagged it though.

In the 4BSD era there was caddr_t, which I think was used for pretty much the same purposes. Did ‘lint’ in the 4BSD era complain about omitted casts to and fro’ caddr_t?

Background to my question is research into the evolution of the socket API in 4.1x BSD and the persistence of ‘struct sockaddr *’ in actual code, even though the design papers show an intent for ‘caddr_t’ (presumably with ‘void*’ semantics, but I’m not sure).

Paul



^ permalink raw reply	[flat|nested] 48+ messages in thread
* [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; 48+ 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] 48+ 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; 48+ 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] 48+ messages in thread

end of thread, other threads:[~2017-11-10 23:58 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-04 10:19 [TUHS] origins of void* Paul Ruizendaal
2017-11-05  9:48 ` Clem Cole
2017-11-05 10:06 ` arnold
2017-11-05 13:20   ` Ron Natalie
2017-11-05 15:14     ` Warner Losh
2017-11-05 17:53       ` Clem cole
2017-11-05 18:29         ` Steve Simon
2017-11-05 20:12           ` Clem cole
2017-11-05 21:08             ` Chet Ramey
2017-11-05 21:38               ` Clem cole
2017-11-05 21:53             ` Steve Simon
2017-11-05 20:44   ` Paul Ruizendaal
2017-11-05 21:06     ` Warner Losh
2017-11-06  7:24     ` arnold
2017-11-06 15:02       ` 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
2017-11-10 23:43                       ` [TUHS] PowerPC, bit twiddling - was " Toby Thain
2017-11-10 23:58                         ` Ralph Corderoy
2017-11-07 15:34 [TUHS] " 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
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

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).