My two questions. One legit, one silly...

P

phaeton

First off, sorry for posting from Google Groups. I am not at my own
machine right now.

Question 1:

I'm not very far into K&R2 just yet, but I notice that Chapter 8 is
"The UNIX System Interface". Is this chapter (and the following
sections therein) still applicable to current UNIX-like operating
systems?

My ridiculous problem:

I know that these days "UNIX" is somewhat vague. It may help me
settle a personal hangup I have about BSD vs. Linux. Both are alright
OSes but for some reason I feel that learning C on a FreeBSD or
(especially) NetBSD system is "closer to home" than it would be on
Linux. I'm sure that this is all emotional and with no factual
basis. Maybe I'm subconsciously trying to follow dmr's footsteps in
the sand a bit more closely.

Justification to self:

Yes I know that both types are perfectly adequate: shells, editors,
compilers and such are the same on both systems. Libraries might be
different but they'll both serve my purposes. I can acquire and study
the source code for everything on both systems.

Question 2:

So does it really matter which system I use, or am I just being
retentive?

Thanks for any input.

-J
 
S

Seebs

I'm not very far into K&R2 just yet, but I notice that Chapter 8 is
"The UNIX System Interface". Is this chapter (and the following
sections therein) still applicable to current UNIX-like operating
systems?

Better than you might expect it to be. It's sort of out of date, but
for the most part, I expect the examples will still run.
I know that these days "UNIX" is somewhat vague. It may help me
settle a personal hangup I have about BSD vs. Linux. Both are alright
OSes but for some reason I feel that learning C on a FreeBSD or
(especially) NetBSD system is "closer to home" than it would be on
Linux. I'm sure that this is all emotional and with no factual
basis. Maybe I'm subconsciously trying to follow dmr's footsteps in
the sand a bit more closely.

For what it's worth, I am a lot more comfortable on the BSD derivatives.
This tells you very little, though.
Question 2:
So does it really matter which system I use, or am I just being
retentive?

I would tend to recommend being at least passingly familiar with more than
one system. There are a lot of things where getting to habituated to one
thing or another makes it harder to adapt.

That said... I basically ignore the Unix system interface unless I'm working
on something which has a very very good reason to use it. I would guess that
90% of the C I work on has no Unix-specific calls in it at all.

-s
 
D

/dev/phaeton

Better than you might expect it to be. It's sort of out of date, but
for the most part, I expect the examples will still run.

That's good to know! A specific system, or all of them about the same?
I was going to read through it anyway, but it's nice to know I can
probably work out the examples and such.

For what it's worth, I am a lot more comfortable on the BSD derivatives.
This tells you very little, though.

Well, so am I actually. I've been flip-flopping back and forth between
linux and BSD systems since the late 90s. I tend to be a follower of
the old UNIX Philosophy about cleanliness, simplicity and economy of
resources. I feel that GNU/Linux (and its userbase) has diverged from
this a bit in the last number of years. I still like Linux but BSD
systems are what feel 'right' to me. I still can't believe how small a
base install of NetBSD is compared to other OSes.
I would tend to recommend being at least passingly familiar with more than
one system. There are a lot of things where getting to habituated to one
thing or another makes it harder to adapt.

That said... I basically ignore the Unix system interface unless I'm working
on something which has a very very good reason to use it. I would guess that
90% of the C I work on has no Unix-specific calls in it at all.

-s

I'll obviously continue to use both systems, I think. (I'm up to 4
computers again, so why not?). Unfortunately I fear that the Netcraft
jokes of old are becoming true and BSD really is dying.

And yes, the right answer is for me to just forget what uname -a says
and just focus on the code. I have a long ways to go before I start
running into anything where the system on hand matters. I will be
especially long for me, because between work, school and a girlfriend I
don't have but a few hours every couple of weeks to put into it. Ah, to
be young again.

Thanks for the reply Seebs.

-J
 
N

Nick Keighley

Question 1:

I'm not very far into K&R2 just yet, but I notice that Chapter 8 is
"The UNIX System Interface".  Is this chapter (and the following
sections therein) still applicable to current UNIX-like operating
systems?

My ridiculous problem:

I know that these days "UNIX" is somewhat vague.  It may help me
settle a personal hangup I have about BSD vs. Linux.  Both are alright
OSes but for some reason I feel that learning C on a FreeBSD or
(especially) NetBSD system is "closer to home" than it would be on
Linux.

I really don't think it matters. C works perfectly well on Windows and
a zillion other OSen. I've used it on the old Mac OS (the one that
wasn't Unix) and I've used it on something wired called Trax. I'd use
whatever you were happy with or was convenient. I'd try to stay away
from OS specific stuff while you're learning C.
 I'm sure that this is all emotional and with no factual
basis.  Maybe I'm subconsciously trying to follow dmr's footsteps in
the sand a bit more closely.

Justification to self:

Yes I know that both types are perfectly adequate: shells, editors,
compilers and such are the same on both systems.  Libraries might be
different but they'll both serve my purposes.

the standard library should be the same. If you stick to that you'll
be well on your way to writing portable code.
 I can acquire and study
the source code for everything on both systems.

Question 2:

So does it really matter which system I use, or am I just being
retentive?

I don't think it matters. I find it odd that you think it does. Unless
of course you intend to get into Unix programming.
 
J

Jorgen Grahn

[Linux vs *BSD]
I'll obviously continue to use both systems, I think. (I'm up to 4
computers again, so why not?). Unfortunately I fear that the Netcraft
jokes of old are becoming true and BSD really is dying.

And yes, the right answer is for me to just forget what uname -a says
and just focus on the code.

Better IMHO is to:

- Pass flags to your compiler saying which standards you want to use.
You use gcc; then say CFLAGS=-std=c99 -Wall -Wextra -pedantic
and look in /usr/include/features.h for how to enable POSIX stuff etc.

- Read the man pages. They almost always say what's e.g. Linux-specific.

- Apart from that, don't worry about systems you don't have access to
anyway. If you're going to program against the lowest common
denominator of all systems called "Unix" in the past with no payoff,
you're just crippling yourself.

/Jorgen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top