473,320 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Strange UNIX "icode" declaration in Lions' book

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
4 1718
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
>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 (40°39.22'N, 111°50.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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

83
by: Alexander Zatvornitskiy | last post by:
Hello All! I'am novice in python, and I find one very bad thing (from my point of view) in language. There is no keyword or syntax to declare variable, like 'var' in Pascal, or special syntax in...
2
by: Thomas Matthews | last post by:
Hi, I'm getting linking errors when I declare a variable in the global scope, but not inside a function. The declarations are the same (only the names have been changed...). class Book {...
12
by: G. | last post by:
Hi all, During my degree, BEng (Hons) Electronics and Communications Engineering, we did C programming every year, but I never kept it up, as I had no interest and didn't see the point. But now...
27
by: hpy_awad | last post by:
I wrote that program from a book that my compile that program correctly under C++ compiler but I got those errors for compiling under unix !! Errors- --------...
0
by: unknown | last post by:
Hi, I am developing an online book store with shopping cart. My shopping cart is represented as a Xml server control and I am using an XSLT to render it at the client side. I am using an...
9
by: fidlee | last post by:
I dont know if this is the right place to ask this question. i got this book "The C Odyssey. Unix - The Open, Boundless C" It is a 1992 edition book The book speaks of all the unix specific...
22
by: James Brodie | last post by:
I just wanted to get some advice on what are the better practices: 1) Should variables be declared at the beginning of a function or just before they are required? 2) Should all variabled be...
28
by: charlie | last post by:
Hi, I found an article on informit.com that talks about C++ casts http://www.informit.com/guides/content.asp?g=cplusplus&seqNum=285&rl=1 The strange thing is the author says the following...
1
by: jazon | last post by:
Let me start by saying this for an Operating Systems class. No, I don't expect the work to be done for me. The assignment is as follows: To be honest, I feel like a fish out of water, like...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.