Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. C is a better language than any language you care to name.

C is a better language than any language you care to name.

Scheduled Pinned Locked Moved The Lounge
csharphtml
150 Posts 54 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Stefan_Lang

    Maybe, but at least it's consistent with the goto/label syntax.

    GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto) Point in case: http://www.infoq.com/news/2014/02/apple_gotofail_lessons[^]

    P Offline
    P Offline
    PIEBALDconsult
    wrote on last edited by
    #128

    Maybe, but break doesn't affect a goto. And I have never used a goto in C.

    You'll never get very far if all you do is follow instructions.

    S 1 Reply Last reply
    0
    • S Stefan_Lang

      Have you read the article?

      Colborne_Greg wrote:

      It can utilize every C, C++, and C# library.

      C can be plugged into any application in any language. The author is aware that C itself lacks libraries and he does mention it. So what was your point again?

      Colborne_Greg wrote:

      Plus it looks pretty.

      Ah that. :doh: Ok, seriously. If you meant it has a better readability, that was mentioned by the author, too. So, again the question, what was your point?

      Colborne_Greg wrote:

      For example the "with" operator is in Visual basic but is not in C.

      And it's in Pascal. So what? Again, the author made a point that other languages offer more (and often more complex) language elements - but that doesn't deterr him from listing a number of advantages of the language C that you failed to address entirely. Disclaimer: I don't actually agree with the article. I just wanted to point out that the article already pointed out or implied everything you said, and you did nothing to argue against it. (if that was your purpose)

      GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto) Point in case: http://www.infoq.com/news/2014/02/apple_gotofail_lessons[^]

      C Offline
      C Offline
      Colborne_Greg
      wrote on last edited by
      #129

      Your signature has a line about GOTO The goto fail example is a major fail in general for the C language. The goto is the first thing every programmer should avoid, but in this example the GOTO's are used correctly, but its a limitation of the C language (one of the dumbest things in history I might add) Visual basic .net is C with English words and no bracket issue, the GOTO fail would never had been an issue in VB.

      S 1 Reply Last reply
      0
      • P PIEBALDconsult

        reflection ???!!! :confused: :omg:

        You'll never get very far if all you do is follow instructions.

        C Offline
        C Offline
        Colborne_Greg
        wrote on last edited by
        #130

        Interesting that your signature is "You'll never get very far if all you do is follow the instructions" fitting for this tread isn't it

        1 Reply Last reply
        0
        • J Joe Woodbury

          You are arguing against something I never said. Specifically, nowhere did I say that the precompiler isn't part of the language. More generally, my point is that the information about the size of the array is known only by the scope of the array declaration at compile time; it is not contained in the array itself and available at runtime. In C, an array and a pointer are, for all intents and purposes, synonymous (with the exception of this very narrow edge case.) So, the [partial] function declarations a(const char* p) and b(const char d[]) mean the same thing. Doing a sizeof(d) for the latter doesn't tell you anything meaningful about the original array. This also means that you can take an arbitrary pointer and use array syntax on it. i.e. p[3]. This gives C an enormous power and flexibility found in few other languages. Attaching any other information to a pointer (or array) changes the very nature of what a pointer is and adds overhead that is often not desired nor wanted (and if desired, you can easily create a struct (or class in C++) with that information contained in it. This very flexibility means that arguing that arrays are problematic in C is a strawman argument.)

          J Offline
          J Offline
          jschell
          wrote on last edited by
          #131

          Joe Woodbury wrote:

          You are arguing against something I never said.

          My bad - you are correct.

          1 Reply Last reply
          0
          • P PIEBALDconsult

            jschell wrote:

            Rather certain that the precompiler is in fact part of the language

            Yes, and as he said in his response, he didn't say otherwise. Some points I'd like to make are: A language is defined by its compiler (not the other way around). DMR probably could have made C without a pre-processor; I see no reason that C has to have a pre-processor other than that it does have a pre-processor. The existence of D and C# may support this view. I have seen (I don't remember where) at least one argument that the C pre-processor acts on a different language than the C compiler does; and I am in about 90% agreement with that point of view. I like the C pre-processor; it's really just a text processing utility -- it can be used for purposes other than its primary usage. (I even use it with C# -- Implanting Common Code in Unrelated Classes[^]) Unfortunately, it also has some functions (e.g. sizeof) that are tightly bound to C. :sigh:

            jschell wrote:

            limiting oneself to just the "language" then C is in fact useless, since one cannot in any practical way do anything useful with the "language"

            You may be arguing that the language is pretty limited without libraries, and that is quite true, very little can be accomplished without at least printf -- I have written a simple program that calculates a value and returns it from main, simply to demonstrate that something, no matter how pointless, can be done without linking in any libraries. However, I think the article was also pointing out the ease with which a developer can leverage a multitude of libraries with C. Just the other week I was playing with ODBC, and linking in only the ODBC libraries and not the "standard C libraries". Of course, doing so still requires the pre-processor, as the Creator intended.

            jschell wrote:

            I am going to take their word for it

            Soooo... if Microsoft says that VB is the World's Greatest Language.... ? :suss:

            J Offline
            J Offline
            jschell
            wrote on last edited by
            #132

            PIEBALDconsult wrote:

            A language is defined by its compiler (not the other way around).

            No. Compiler theory is a very complete area of study in computer science and most perhaps all successful languages build upon that. And within compiler theory the compiler is an implementation, nothing more. And in terms of C, although perhaps not specifically this discussion, there are many ambiguities which the compiler is allowed to define but others which it is not.

            PIEBALDconsult wrote:

            I like the C pre-processor; it's really just a text processing utility -- it can be used for purposes other than its primary usage

            With something like 20 years of C/C++ experience I am pretty comfortable with what the language is and isn't.

            PIEBALDconsult wrote:

            and that is quite true,

            As I said.

            PIEBALDconsult wrote:

            Soooo... if Microsoft says that VB is the World's Greatest Language....

            Well first I was noting a technical point not a subjective one. Second K&R when it was written was written in a different style than VB, so even if the author(s) of VB made a technical point then I would be less inclined to accept it (which is true of C# and Java as well.)

            1 Reply Last reply
            0
            • C Chris Maunder

              Discuss. I've just read The Unreasonable Effectiveness of C[^] and decided to outsource my ranting response to it

              cheers Chris Maunder

              B Offline
              B Offline
              Br Bill
              wrote on last edited by
              #133

              Oh, there are better languages. I just don't care to name them. ;) I care about so few things.

              1 Reply Last reply
              0
              • C Colborne_Greg

                Your signature has a line about GOTO The goto fail example is a major fail in general for the C language. The goto is the first thing every programmer should avoid, but in this example the GOTO's are used correctly, but its a limitation of the C language (one of the dumbest things in history I might add) Visual basic .net is C with English words and no bracket issue, the GOTO fail would never had been an issue in VB.

                S Offline
                S Offline
                Stefan_Lang
                wrote on last edited by
                #134

                You've completely missed my point. My sig should have made it obvious I abhor the use of goto. I merely pointed out a possible reason why case may have been specified the way it is. Not that I wouldn't like to ban goto from the language entirely. And not that I would miss the switch statement for that matter (not much anyway). It was just a statement about the consistency of the language as a whole. As for your love of Basic - to each their own. It certainly has it's use for certain kind of applications. Me, I've been working on processing-intensive applications for decades, and no Basic dialect whatsoever, not even the compiled ones, would ever have served the purpose. That said, I'll remove the link from my sig: as you've pointed out, the main reason for the problem isn't so much the use of goto - it is the fact that braces (or other block markers) are only optional after control statements, combined with an unlucky duplicate line of code - that this line contains a goto command is just happenstance, many other commands would have caused havoc as well. On a sidenote:

                Colborne_Greg wrote:

                Visual basic .net is C with English words and no bracket issue, the GOTO fail would never had been an issue in VB.

                Which part of go to isn't english? Just wondering...

                GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto) Point in case: http://www.infoq.com/news/2014/02/apple_gotofail_lessons[^]

                C 1 Reply Last reply
                0
                • P PIEBALDconsult

                  Maybe, but break doesn't affect a goto. And I have never used a goto in C.

                  You'll never get very far if all you do is follow instructions.

                  S Offline
                  S Offline
                  Stefan_Lang
                  wrote on last edited by
                  #135

                  My point was that a series of case statements resembles a series of goto jump labels, and therefore there is an expectation for the flow of execution to continue, even past the next 'label'. The break command isn't associated to the case statement, it is associated to the switch block.

                  GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

                  P 1 Reply Last reply
                  0
                  • S Stefan_Lang

                    My point was that a series of case statements resembles a series of goto jump labels, and therefore there is an expectation for the flow of execution to continue, even past the next 'label'. The break command isn't associated to the case statement, it is associated to the switch block.

                    GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

                    P Offline
                    P Offline
                    PIEBALDconsult
                    wrote on last edited by
                    #136

                    Stefan_Lang wrote:

                    resembles a series goto

                    Not to me it doesn't.

                    You'll never get very far if all you do is follow instructions.

                    S 1 Reply Last reply
                    0
                    • P PIEBALDconsult

                      Kenneth Kasajian wrote:

                      Pascal

                      Aaaannnd... how do you work with very long strings? Very large structures*? * Maybe only a problem with Turbo Pascal with its 64K per structure limit.

                      You'll never get very far if all you do is follow instructions.

                      K Offline
                      K Offline
                      Kenneth Kasajian
                      wrote on last edited by
                      #137

                      I think I may not have been clear in my point because I don't understand what you're asking me. I'm not saying Pascal is better than C or the other way around. I'm saying Pascal is a language that was not originally written in C. It was written in Fortran, after which it was bootstrapped to be written in itself.

                      ken@kasajian.com / www.kasajian.com

                      P 1 Reply Last reply
                      0
                      • P PIEBALDconsult

                        Kenneth Kasajian wrote:

                        Pascal

                        Aaaannnd... how do you work with very long strings? Very large structures*? * Maybe only a problem with Turbo Pascal with its 64K per structure limit.

                        You'll never get very far if all you do is follow instructions.

                        K Offline
                        K Offline
                        Kenneth Kasajian
                        wrote on last edited by
                        #138

                        Also to answer the more specific question, I don't think the language has anything to do with 64K limits, for strings, or otherwise. Those are all implementation details of specific compilers.

                        ken@kasajian.com / www.kasajian.com

                        P 1 Reply Last reply
                        0
                        • K Kenneth Kasajian

                          I think I may not have been clear in my point because I don't understand what you're asking me. I'm not saying Pascal is better than C or the other way around. I'm saying Pascal is a language that was not originally written in C. It was written in Fortran, after which it was bootstrapped to be written in itself.

                          ken@kasajian.com / www.kasajian.com

                          P Offline
                          P Offline
                          PIEBALDconsult
                          wrote on last edited by
                          #139

                          It sure looks like you are proposing that Pascal is a better language than C, based on certain criteria. Pascal is indeed a very good language and I really liked it when I was using it in college, but I haven't used it since, and I can't even read/understand the code I have from that period.

                          Kenneth Kasajian wrote:

                          Pascal is a language that was not originally written in C

                          Nor was C.

                          Kenneth Kasajian wrote:

                          after which it was bootstrapped to be written in itself

                          As was C.

                          You'll never get very far if all you do is follow instructions.

                          K 1 Reply Last reply
                          0
                          • K Kenneth Kasajian

                            Also to answer the more specific question, I don't think the language has anything to do with 64K limits, for strings, or otherwise. Those are all implementation details of specific compilers.

                            ken@kasajian.com / www.kasajian.com

                            P Offline
                            P Offline
                            PIEBALDconsult
                            wrote on last edited by
                            #140

                            Kenneth Kasajian wrote:

                            implementation details of specific compilers

                            That may well be, but is it not part of the Pascal language spec that a string is limited to 255 characters because the length is stored in the first byte of the string? I suppose not every implementation uses 8-bit characters, but it still imposes a definite limitation other than "available system resources".

                            You'll never get very far if all you do is follow instructions.

                            K 1 Reply Last reply
                            0
                            • P PIEBALDconsult

                              It sure looks like you are proposing that Pascal is a better language than C, based on certain criteria. Pascal is indeed a very good language and I really liked it when I was using it in college, but I haven't used it since, and I can't even read/understand the code I have from that period.

                              Kenneth Kasajian wrote:

                              Pascal is a language that was not originally written in C

                              Nor was C.

                              Kenneth Kasajian wrote:

                              after which it was bootstrapped to be written in itself

                              As was C.

                              You'll never get very far if all you do is follow instructions.

                              K Offline
                              K Offline
                              Kenneth Kasajian
                              wrote on last edited by
                              #141

                              No, you have completely missed the point of my message. Go back and re-read it. What I am saying is that, a lot of people bash C but those same people don't realize that whatever language they prefer is probably written in C. So I challenged the readers to name a language that was not written in C.. because it's hard to do. Most new languages, VB, JavaScript, Python, Ruby all written in C. However, there are languages not originally written in C, although they are old. Pascal is one, which is the one I mentioned to get the ball rolling. You're being unnecessarily antagonistic without understanding, or taking the time to read, what I'm saying. I suggest you drop it.

                              ken@kasajian.com / www.kasajian.com

                              P 1 Reply Last reply
                              0
                              • P PIEBALDconsult

                                Kenneth Kasajian wrote:

                                implementation details of specific compilers

                                That may well be, but is it not part of the Pascal language spec that a string is limited to 255 characters because the length is stored in the first byte of the string? I suppose not every implementation uses 8-bit characters, but it still imposes a definite limitation other than "available system resources".

                                You'll never get very far if all you do is follow instructions.

                                K Offline
                                K Offline
                                Kenneth Kasajian
                                wrote on last edited by
                                #142

                                Okay, although it's true that one can implement Pascal differently, you're right that it's limited to 64K (or 32K) in length for strings. But I really don't think that's a good example of Pascal's inferiority over C. There's advantages to counted-strings, and I've worked in environments where actually simulated Pascal strings in C for efficiency (i.e. you can easily get to the length). COM BSTRs use a similar structure, but store 32-bit lengths. And the reason I don't think it's a limitation is because if you needed a string that long, C's null-terminated string is hardly preferable. You likely need a different data-structure (rope, array of strings) to do whatever you're doing anyway. Or, more likely, it's that big, it's probably a memory buffer that you'd manage using address and count. As a reminder, my initial post was not stating Pascal is better than C. It was to point out that many of today's languages are written in C.

                                ken@kasajian.com / www.kasajian.com

                                P 1 Reply Last reply
                                0
                                • K Kenneth Kasajian

                                  No, you have completely missed the point of my message. Go back and re-read it. What I am saying is that, a lot of people bash C but those same people don't realize that whatever language they prefer is probably written in C. So I challenged the readers to name a language that was not written in C.. because it's hard to do. Most new languages, VB, JavaScript, Python, Ruby all written in C. However, there are languages not originally written in C, although they are old. Pascal is one, which is the one I mentioned to get the ball rolling. You're being unnecessarily antagonistic without understanding, or taking the time to read, what I'm saying. I suggest you drop it.

                                  ken@kasajian.com / www.kasajian.com

                                  P Offline
                                  P Offline
                                  PIEBALDconsult
                                  wrote on last edited by
                                  #143

                                  Sooo... your post is totally unrelated to Chris' prompt for discussion of languages that are or are not better than C. OK.

                                  Kenneth Kasajian wrote:

                                  Go back and re-read it

                                  I have read it many times, always in the context of the thread.

                                  Kenneth Kasajian wrote:

                                  a lot of people bash C but those same people don't realize that whatever language they prefer is probably written in C

                                  So what?

                                  Kenneth Kasajian wrote:

                                  I challenged the readers to name a language that was not written in C

                                  You could have made that clearer.

                                  Kenneth Kasajian wrote:

                                  not originally written in C ... Pascal is one

                                  Pascal pre-dates C slightly, it certainly pre-dates C's popularity. COBOL, Fortran, and BASIC also pre-date C.

                                  You'll never get very far if all you do is follow instructions.

                                  1 Reply Last reply
                                  0
                                  • K Kenneth Kasajian

                                    Okay, although it's true that one can implement Pascal differently, you're right that it's limited to 64K (or 32K) in length for strings. But I really don't think that's a good example of Pascal's inferiority over C. There's advantages to counted-strings, and I've worked in environments where actually simulated Pascal strings in C for efficiency (i.e. you can easily get to the length). COM BSTRs use a similar structure, but store 32-bit lengths. And the reason I don't think it's a limitation is because if you needed a string that long, C's null-terminated string is hardly preferable. You likely need a different data-structure (rope, array of strings) to do whatever you're doing anyway. Or, more likely, it's that big, it's probably a memory buffer that you'd manage using address and count. As a reminder, my initial post was not stating Pascal is better than C. It was to point out that many of today's languages are written in C.

                                    ken@kasajian.com / www.kasajian.com

                                    P Offline
                                    P Offline
                                    PIEBALDconsult
                                    wrote on last edited by
                                    #144

                                    Kenneth Kasajian wrote:

                                    I don't think it's a limitation

                                    Perhaps you just don't find the limit to be a hindrance. I never had any trouble with it either, but I never had to use Pascal to do real-world development. Just as .net strings are limited to 2GB -- it's a limit, but it hasn't yet been a hindrance.

                                    Kenneth Kasajian wrote:

                                    C's null-terminated string is hardly preferable

                                    They certainly have some disadvantages, but at least they're easy to work around.

                                    You'll never get very far if all you do is follow instructions.

                                    1 Reply Last reply
                                    0
                                    • S Stefan_Lang

                                      You've completely missed my point. My sig should have made it obvious I abhor the use of goto. I merely pointed out a possible reason why case may have been specified the way it is. Not that I wouldn't like to ban goto from the language entirely. And not that I would miss the switch statement for that matter (not much anyway). It was just a statement about the consistency of the language as a whole. As for your love of Basic - to each their own. It certainly has it's use for certain kind of applications. Me, I've been working on processing-intensive applications for decades, and no Basic dialect whatsoever, not even the compiled ones, would ever have served the purpose. That said, I'll remove the link from my sig: as you've pointed out, the main reason for the problem isn't so much the use of goto - it is the fact that braces (or other block markers) are only optional after control statements, combined with an unlucky duplicate line of code - that this line contains a goto command is just happenstance, many other commands would have caused havoc as well. On a sidenote:

                                      Colborne_Greg wrote:

                                      Visual basic .net is C with English words and no bracket issue, the GOTO fail would never had been an issue in VB.

                                      Which part of go to isn't english? Just wondering...

                                      GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto) Point in case: http://www.infoq.com/news/2014/02/apple_gotofail_lessons[^]

                                      C Offline
                                      C Offline
                                      Colborne_Greg
                                      wrote on last edited by
                                      #145

                                      I programmed Unidex in visual basic, there isn't a conditional statement involved in retrieving a value from a serialized file (no sql) it can handle creating 8 million records an hour, and can read 2.3 billion records an hour.

                                      S 1 Reply Last reply
                                      0
                                      • P PIEBALDconsult

                                        Stefan_Lang wrote:

                                        resembles a series goto

                                        Not to me it doesn't.

                                        You'll never get very far if all you do is follow instructions.

                                        S Offline
                                        S Offline
                                        Stefan_Lang
                                        wrote on last edited by
                                        #146

                                        Because you chose to ignore the part that I specifically underlined. I didn't say goto, I said goto jump labels - that is a world of a difference! How is the following

                                        switch(a) {
                                        case 1:
                                        ...
                                        case 2:
                                        ...
                                        }

                                        different from

                                        on a goto label1, label2
                                        label1:
                                        ...
                                        label2:
                                        ...

                                        ? The multilabel on ... goto variant is present in many BASIC variants.

                                        GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

                                        P 1 Reply Last reply
                                        0
                                        • C Colborne_Greg

                                          I programmed Unidex in visual basic, there isn't a conditional statement involved in retrieving a value from a serialized file (no sql) it can handle creating 8 million records an hour, and can read 2.3 billion records an hour.

                                          S Offline
                                          S Offline
                                          Stefan_Lang
                                          wrote on last edited by
                                          #147

                                          :zzz: You didn't get the point of anything I said. But nevermind. I've got it that you prefer VB from your first posting. That's fine. Have a nice day.

                                          GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups