9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] 2c(2) error
@ 2015-03-10 15:53 Giacomo Tesio
  2015-03-10 16:00 ` Giacomo Tesio
  0 siblings, 1 reply; 2+ messages in thread
From: Giacomo Tesio @ 2015-03-10 15:53 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs, 9front


[-- Attachment #1.1: Type: text/plain, Size: 563 bytes --]

2c(2) states:

Array initializers can specify the indices of the array in
>   square brackets, as
>       int a[] = { [3] 1, [10] 5 };
>   which initializes the third and tenth elements of the
>   eleven-element array a.


This is somewhat confusing: the third and the tenth element should have
index 2 and 9. Moreover if the tenth element is actually referred by index
10, why the array should hold eleven elements?

A simple check shows that actually the array has 11 elements and the one
initialized are the forth and the eleventh.


Giacomo

[-- Attachment #1.2: Type: text/html, Size: 862 bytes --]

[-- Attachment #2: man.2c.diff --]
[-- Type: text/plain, Size: 371 bytes --]

diff -r 51285ae4f545 sys/man/1/2c
--- a/sys/man/1/2c	Thu Mar 05 10:17:23 2015 +0100
+++ b/sys/man/1/2c	Tue Mar 10 16:52:03 2015 +0100
@@ -250,7 +250,7 @@
 .EX
     int a[] = { [3] 1, [10] 5 };
 .EE
-which initializes the third and tenth elements of the eleven-element array
+which initializes the forth and eleventh elements of the eleven-element array
 .BR a .
 .TP
 \-

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

* Re: [9fans] 2c(2) error
  2015-03-10 15:53 [9fans] 2c(2) error Giacomo Tesio
@ 2015-03-10 16:00 ` Giacomo Tesio
  0 siblings, 0 replies; 2+ messages in thread
From: Giacomo Tesio @ 2015-03-10 16:00 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs, 9front

[-- Attachment #1: Type: text/plain, Size: 737 bytes --]

Ehm... obviously I was talking about 2c(1)...

Too much coffe, today... :-D

2015-03-10 16:53 GMT+01:00 Giacomo Tesio <giacomo@tesio.it>:

> 2c(2) states:
>
> Array initializers can specify the indices of the array in
>>   square brackets, as
>>       int a[] = { [3] 1, [10] 5 };
>>   which initializes the third and tenth elements of the
>>   eleven-element array a.
>
>
> This is somewhat confusing: the third and the tenth element should have
> index 2 and 9. Moreover if the tenth element is actually referred by index
> 10, why the array should hold eleven elements?
>
> A simple check shows that actually the array has 11 elements and the one
> initialized are the forth and the eleventh.
>
>
> Giacomo
>

[-- Attachment #2: Type: text/html, Size: 1373 bytes --]

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

end of thread, other threads:[~2015-03-10 16:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-10 15:53 [9fans] 2c(2) error Giacomo Tesio
2015-03-10 16:00 ` Giacomo Tesio

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