By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,118 Members | 1,277 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,118 IT Pros & Developers. It's quick & easy.

Strange UNIX "icode" declaration in Lions' book

P: n/a
I read the following code in `Lions' Commentary on UNIX 6th Edition
with Source Code'. The code in the book labeled from line 1516 to 1529
declaring "icode" is strange. Was one equal mark missed at line 1516
behind the right square brace?

1516 int icode[]
1517 {
1518 0104412, /*sys exec; init; initp*/
1519 0000014,
1520 0000010,
.... /*...*/
1529 };

lovecreatesbeauty

Jul 12 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
lovecreatesbeauty wrote:
I read the following code in `Lions' Commentary on UNIX 6th Edition
with Source Code'. The code in the book labeled from line 1516 to 1529
declaring "icode" is strange. Was one equal mark missed at line 1516
behind the right square brace?

1516 int icode[]
1517 {
1518 0104412, /*sys exec; init; initp*/
1519 0000014,
1520 0000010,
... /*...*/
1529 };
I seem to recall that once upon a time initialisers didn't need
an `=` sign. Sadly a quick google doesn't find supporting
evidence, apart from a very weak hint about a "change". Anyone
got a reference (for confimation or refutation)?

--
Chris "seeker" Dollin
"Reaching out for mirrors hidden in the web." - Renaissance, /Running Hard/

Jul 12 '06 #2

P: n/a
>lovecreatesbeauty wrote:
>I read the following code in `Lions' Commentary on UNIX 6th Edition
with Source Code'. [missing "=" in initializer: "int i 3;" etc.]
In article <e9**********@malatesta.hpl.hp.com>,
Chris Dollin <ch**********@hp.comwrote:
>I seem to recall that once upon a time initialisers didn't need
an `=` sign. Sadly a quick google doesn't find supporting
evidence, apart from a very weak hint about a "change". Anyone
got a reference (for confimation or refutation)?
In Version 6 C, initializers did not use "=":

int i 3;
int j[] { 0, 1, 2 };

In addition, if you started a file with any character other than "#",
the preprocessor did not run; so:

/* this is a V6 C program */

#define THIS 1

would not work as desired. (For this reason, a lot of V6 C programs
started with "#" on a line by itself.)

In similar oddness, one wrote, e.g.:

printf(2, "error message\n");

to send the printf() output to stderr. There was no fprintf() (not
until the "standard I/O library" was written, at least; and you
had to ask for that with "-lS" on the link line.)

Of course, none of this is even slightly odd compared to even-earlier
C:

struct (
int a; /* holds positive and negative values */
char *b; /* holds values from 0 to 65535 */
);

Yes, those are parentheses, not braces; and to hold unsigned integers,
one used pointers. (There was no "unsigned" keyword yet.)
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (4039.22'N, 11150.29'W) +1 801 277 2603
email: forget about it http://web.torek.net/torek/index.html
Reading email is like searching for food in the garbage, thanks to spammers.
Jul 12 '06 #3

P: n/a
Chris Dollin <ch**********@hp.comwrote:
>
I seem to recall that once upon a time initialisers didn't need
an `=` sign. Sadly a quick google doesn't find supporting
evidence, apart from a very weak hint about a "change". Anyone
got a reference (for confimation or refutation)?
K&R 1, A.17, Anachronisms:

The syntax of initializers has changed: previously, the equals
sign that introduces an initializer was not present...

-Larry Jones

I always send Grandma a thank-you note right away. ...Ever since she
sent me that empty box with the sarcastic note saying she was just
checking to see if the Postal Service was still working. -- Calvin
Jul 12 '06 #4

P: n/a
la************@ugs.com wrote:
Chris Dollin <ch**********@hp.comwrote:
>>
I seem to recall that once upon a time initialisers didn't need
an `=` sign. Sadly a quick google doesn't find supporting
evidence, apart from a very weak hint about a "change". Anyone
got a reference (for confimation or refutation)?

K&R 1, A.17, Anachronisms:

The syntax of initializers has changed: previously, the equals
sign that introduces an initializer was not present...
Thanks, Larry. I wish I'd thought to check the copy of K&R1 that I
happen to have on my shelf here ...

Obviously I should either migrate into virtual space, or devise a
googleike that works on physical books, scrappy notes, decaying
photocopies, and the remaining faint vibrations of long-passed
conversations.

--
Chris "planning for April 2007" Dollin
A rock is not a fact. A rock is a rock.

Jul 13 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.