Thread: general question

  1. #16
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Elysia View Post
    Type safety, generic programming facilities, abstraction.
    And once more, the kernel is just built using year-old technologies, so it doesn't support any modern technologies. The foundation is flawed.
    That doesn't mean C++ is at fault - it means the foundation is.
    I don't think we can say that Linux or Windows is FLAWED because it is written in C. But neither can we say that C++ would make that task impossible.

    Designing an OS is difficult. Using C or C++ is a small matter in the whole process. But once you go down the line of using one, it's pretty darn difficult to change that decision without major upheaval of API's and such. This is the major reason why there's no immediate projects to modify Linux or Windows to use C++ instead of C. The whole OS has to be designed that way initially.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  2. #17
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I did not mean to imply it is flawed because it uses C.
    I mean to imply that if a kernel cannot support C++ code, then its foundation is flawed in such a way that it cannot use C++. But it doesn't necessarily mean it's a BAD foundation, because that is a design choice - shall we build it for C++ support or for C support only?
    The Windows and Linux kernels aren't flawed; at the time they were built, there was only C - and so they made a design decision to only support C.
    The point is, again, that C++ isn't suited for this kind of job - the kernel (Windows, Linux) wasn't designed for C++!
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #18
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Flawed is a rather odd word to use. Is it a flaw that I can't program the kernel in BASIC? Is it a flaw that I can't program it in ALGO? Not the best word choice, in my opinion.

    It's not a flaw that I can't use tractor tires on my car. It just isn't designed to fit that size of tire.


    Quzah.
    Hope is the first step on the road to disappointment.

  4. #19
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I didn't exactly find the right words, either, though...
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #20
    Registered User Maz's Avatar
    Join Date
    Nov 2005
    Location
    Finland
    Posts
    194
    Quote Originally Posted by matsp View Post
    Of course, if you are NOT using object oriented style or any other feature of C++, then C++ is just a bigger C compiler. And there is no point in that.

    --
    Mats
    Actually, you can use C so, that you'll achieve the basic princibles of object oriented coding. (Except proper encapsulation perhaps).

    But I know some embedded platform SW written in C++ too. And it is not that terribly after all - although I would rather see C. But to answer to the original questions, C is far from obsolete, and at least where I studied at university, there was far too little courses based on C. It was all java and some C++ :/

  6. #21
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Maz View Post
    Actually, you can use C so, that you'll achieve the basic princibles of object oriented coding. (Except proper encapsulation perhaps).
    Of course, but it's error prone and tedious still.
    C++ lends itself naturally to such things and it's less error prone which is why it is to prefer.

    But I know some embedded platform SW written in C++ too. And it is not that terribly after all - although I would rather see C. But to answer to the original questions, C is far from obsolete, and at least where I studied at university, there was far too little courses based on C. It was all java and some C++ :/
    I would like to see more universities teach C++ instead of C.
    Too many people around here who pick up C and basically get stuck on everything.
    Of the many C++ posts, many of them are of design problems rather than fundamentals.
    In short, there are too many people learning C, and too many I assume think it's the language of choice for any type of program (ie they haven't heard of C++, Java or any other high-level language).
    Actually, I would like to see an introductory course to programming where students have the ability to specialize in a language later in the course, rather than free course, where students obviously not always know what to pick.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #22
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Ah yes, what would we do without these ever popular LanguageX is better than LanguageY threads?


    Quzah.
    Hope is the first step on the road to disappointment.

  8. #23
    Registered User Maz's Avatar
    Join Date
    Nov 2005
    Location
    Finland
    Posts
    194
    Quote Originally Posted by Elysia View Post
    Of course, but it's error prone and tedious still.
    C++ lends itself naturally to such things and it's less error prone which is why it is to prefer.
    Yes. It is error prone, but fully doable. And at times even usefull.
    And maybe I did not write my thoughts behind the sentence well enough. Many (C++ - abd other) programmers make quite a fuss about OOP. One can at times get a feeling, that OOP is THE purpose, OOP itself is often told to be the justification to use OOP.

    How ever, I have found out that people often overdo things with OOP. Too deep going inheritance may lead to situations, where at top level we redo things done at bottom classes.. It's kind of an onien effect. In my experience OOP can be a good tool at times, but yes, you can go terribly wrong with OOP. Sometimes it feels that the porpose of OOP coders is just to find out a new nifty OOPism... Sometimes things are just simpler to do with procedural languages. And C (as C++) allow writing both OOP and procedural code, however C++ coders are often so deep in their OOP thingking, that they cannot see the wood due to the forest...

    Quote Originally Posted by Elysia View Post
    I would like to see more universities teach C++ instead of C.
    Too many people around here who pick up C and basically get stuck on everything.
    Of the many C++ posts, many of them are of design problems rather than fundamentals.
    In short, there are too many people learning C, and too many I assume think it's the language of choice for any type of program (ie they haven't heard of C++, Java or any other high-level language).
    Actually, I would like to see an introductory course to programming where students have the ability to specialize in a language later in the course, rather than free course, where students obviously not always know what to pick.
    In my experience, yes. C may be hard at first. Beginner surely does mistakes with inputs, loop indexes and so on. (But they may well do same mistakes with C++, and in addition to that, there's whole bunch of things that can go wrong with Cpp). Maybe so many beginners indeed post their problems at C forums, because they have started with C. But would they do perfect code right away if they had started with C++? No.

    And to go a bit further. C is simpler than C++. Significantly. In an year or two, a guy with normal brain capacity will learn the princibles of C. They will surely need to learn things about OSes and libraries, but they already know C. However even 10 years will not teach you all the tedious bits in C++. There's multibillionskillion ways to mess the design, and go wrong with "oh so admired" inbuilt OOP support.

    (personal opinions - everybody can have their own )

  9. #24
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Maz View Post
    Yes. It is error prone, but fully doable. And at times even usefull.
    And maybe I did not write my thoughts behind the sentence well enough. Many (C++ - abd other) programmers make quite a fuss about OOP. One can at times get a feeling, that OOP is THE purpose, OOP itself is often told to be the justification to use OOP.

    How ever, I have found out that people often overdo things with OOP. Too deep going inheritance may lead to situations, where at top level we redo things done at bottom classes.. It's kind of an onien effect. In my experience OOP can be a good tool at times, but yes, you can go terribly wrong with OOP. Sometimes it feels that the porpose of OOP coders is just to find out a new nifty OOPism... Sometimes things are just simpler to do with procedural languages. And C (as C++) allow writing both OOP and procedural code, however C++ coders are often so deep in their OOP thingking, that they cannot see the wood due to the forest...
    True. That is a fault everyone makes.
    OOP has its purposes, just as procedural programming does.
    But just as C++ programmers sometimes go too deep with OOP, C programmers sometimes make things too complicated.
    No one is perfect.

    In my experience, yes. C may be hard at first. Beginner surely does mistakes with inputs, loop indexes and so on. (But they may well do same mistakes with C++, and in addition to that, there's whole bunch of things that can go wrong with Cpp). Maybe so many beginners indeed post their problems at C forums, because they have started with C. But would they do perfect code right away if they had started with C++? No.
    They tend to get stuck more on the design rather than getting basic programs working...
    Sometimes it might just be that they try to make their programs too flexible - and thus making them overcomplicated.

    And to go a bit further. C is simpler than C++. Significantly. In an year or two, a guy with normal brain capacity will learn the princibles of C. They will surely need to learn things about OSes and libraries, but they already know C. However even 10 years will not teach you all the tedious bits in C++. There's multibillionskillion ways to mess the design, and go wrong with "oh so admired" inbuilt OOP support.
    There are oh so many pitfalls in coding in C, too. And it's usually full of bugs and pitfalls.
    C++ just moves them up to a higher level.
    And actually, you don't need a huge understanding of C++ to use it. It doesn't need to take 10 years. I dare say that you can read Accelerated C++ and start using it right away.

    Anyway, it's sticks and stones. Some like Higher level, some Lower level, so I'm just saying that this is all subjective.
    But the original topic about why C++ isn't used in the Kernel is that the developer or owner is biased ("the crap that is C++").
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #25
    Registered User Maz's Avatar
    Join Date
    Nov 2005
    Location
    Finland
    Posts
    194
    I know I should've stopped, but I really can't help it.

    You wrote that one can quite easily get started with writing C++. It might be true. But I believe same goes with C too.

    However what happens to a guy when he starts working in some existing project? First thing he needs to do is usually to look at some existing code. With C, after knowing the fundamentals one can easily follow the code, and see what each function etc do. But with Cpp, if existing code has been written by someone who uses all advanced featuires of C++... Heck, I've been programming quite a few years, but I would propably feel lost if I needed tp investigate code written by some C++ guru with all fancy C++ features.

    But as you stated, it really is about personal preferneces. This kind of discussion is almost impossible to have ... objectively

  11. #26
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I feel lost whenever I start looking into C code, even though I am good at both C and C++ (even though I rarely do C)
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A general question aout programming?
    By bradt93 in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 03-26-2008, 11:00 AM
  2. winsock - general question
    By keira in forum Windows Programming
    Replies: 1
    Last Post: 09-28-2007, 01:56 PM
  3. another exercise question
    By luigi40 in forum C# Programming
    Replies: 3
    Last Post: 11-28-2005, 03:52 PM
  4. general programming compatability question
    By Metarectilinear in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 10-25-2002, 11:51 PM
  5. general question regarding a function parameter
    By mlupo in forum C Programming
    Replies: 7
    Last Post: 10-13-2002, 07:32 PM