[ih] 13 the unlucky number

Joseph Touch touch at strayalpha.com
Tue Aug 11 10:51:01 PDT 2020


It seems like the input functions of the implementations vary. When using scanf:

	%d, %x, %o 	= interpret the input as only decimal, hex, or octal (respectively)

	%I			= interpret the input based on its format:
						0x… 	= hex
						0…		= octal
						(1-9)…	= decimal
						0b…	= binary (in some systems)

It looks like MacOS is using %d and linux/others are using %I

Joe
	

> On Aug 11, 2020, at 9:50 AM, Carsten Bormann via Internet-history <internet-history at elists.isoc.org> wrote:
> 
> On 2020-08-11, at 01:58, Alejandro Acosta via Internet-history <internet-history at elists.isoc.org> wrote:
>> 
>>      010.rrr.rrr.rrr   ARPANET       ARPANET [17,1,VGC]
> 
> Off-topic, but I can’t read this in any other way than as an octal number.
> 
> $ ping 010.010.010.010
> PING 010.010.010.010 (8.8.8.8) 56(84) bytes of data.
> 64 bytes from 8.8.8.8: icmp_seq=1 ttl=119 time=6.35 ms
> $ ping 134744072
> PING 134744072 (8.8.8.8) 56(84) bytes of data.
> 64 bytes from 8.8.8.8: icmp_seq=1 ttl=119 time=6.31 ms
> $ ping 01002004010
> PING 01002004010 (8.8.8.8) 56(84) bytes of data.
> 64 bytes from 8.8.8.8: icmp_seq=1 ttl=119 time=6.31 ms
> $ ping 0x8080808
> PING 0x8080808 (8.8.8.8) 56(84) bytes of data.
> 64 bytes from 8.8.8.8: icmp_seq=1 ttl=119 time=6.30 ms
> 
> Does anyone remember how this misfeature crept into the C library?
> (I seem to remember seeing it all the way back to 4.2BSD.  
> It no longer works with macOS, but still does on the Linuxes I tried.)
> 
> Grüße, Carsten
> 
> -- 
> Internet-history mailing list
> Internet-history at elists.isoc.org
> https://elists.isoc.org/mailman/listinfo/internet-history




More information about the Internet-history mailing list