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

Discussion in 'C Programming' started by phaeton, Dec 27, 2011.

  1. phaeton

    phaeton Guest

    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
     
    phaeton, Dec 27, 2011
    #1
    1. Advertising

  2. phaeton

    Seebs Guest

    On 2011-12-27, phaeton <> wrote:
    > 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
    --
    Copyright 2011, all wrongs reversed. Peter Seebach /
    http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
    http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
    I am not speaking for my employer, although they do rent some of my opinions.
     
    Seebs, Dec 28, 2011
    #2
    1. Advertising

  3. phaeton

    /dev/phaeton Guest

    On 12/27/2011 06:09 PM, Seebs wrote:
    > On 2011-12-27, phaeton<> wrote:
    >> 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.


    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.

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


    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
     
    /dev/phaeton, Dec 28, 2011
    #3
  4. Re: My two questions. One legit, one silly...

    On Dec 27, 11:25 pm, phaeton <> wrote:

    > 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.
     
    Nick Keighley, Dec 28, 2011
    #4
  5. phaeton

    Jorgen Grahn Guest

    On Wed, 2011-12-28, /dev/phaeton wrote:
    > On 12/27/2011 06:09 PM, Seebs wrote:
    >> On 2011-12-27, phaeton<> wrote:


    [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

    --
    // Jorgen Grahn <grahn@ Oo o. . .
    \X/ snipabacken.se> O o .
     
    Jorgen Grahn, Dec 28, 2011
    #5
  6. phaeton

    /dev/phaeton Guest

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

    Thanks everyone. You've all been helpful.

    -J
     
    /dev/phaeton, Dec 29, 2011
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bill ramsay

    two silly questions

    bill ramsay, Jun 3, 2004, in forum: Python
    Replies:
    3
    Views:
    323
    bill ramsay
    Jun 4, 2004
  2. Michael B Allen

    memcpy as macro legit?

    Michael B Allen, Nov 19, 2004, in forum: C Programming
    Replies:
    14
    Views:
    716
    Dan Pop
    Nov 26, 2004
  3. Bob
    Replies:
    0
    Views:
    532
  4. Liam
    Replies:
    1
    Views:
    379
  5. nick
    Replies:
    43
    Views:
    378
    Richard Cornford
    Apr 6, 2010
Loading...

Share This Page