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. Understanding the Influence of C Programming in C# .NET

Understanding the Influence of C Programming in C# .NET

Scheduled Pinned Locked Moved The Lounge
csharpgame-devperformanceasp-net
32 Posts 22 Posters 19 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.
  • H honey the codewitch

    I don't think of them as much the same. They're both C family so the syntax is similar, but that's about where the similarities end. The datatypes for example, appear the same but they are not. A C int is not equivalent to a C# concept of an int as C's word size is not fixed, but varies by machine. Floats and doubles are the same but that probably has as much to do with IEEE as anything. Using pointers in C# raises the question of why not use C? More importantly, the unsafe context only works on code that is fully trusted, greatly limiting where and how it can be deployed. There's almost nothing you can do with unsafe that you can't do with the marshalling infrastructure. Finally, using pointers often harms GC performance because you have to pin memory addresses so they don't get relocated during a collection. I don't know how hard it is to grasp OOP. I picked it up in the 1980s. It has been too long, but I don't remember it being especially difficult - particularly once you understand how C++ implements classes and that you can make virtually the same constructs in C, just more verbose. C is cross compatible source code. C# is cross compatible binary code. C# requires a VM. C does not. C runs in far more places - places where C# will never run.

    Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

    0 Offline
    0 Offline
    0x01AA
    wrote on last edited by
    #10

    Agree, except: C# requires a VM ... unless I misunderstood your statement

    H 1 Reply Last reply
    0
    • 0 0x01AA

      Agree, except: C# requires a VM ... unless I misunderstood your statement

      H Offline
      H Offline
      honey the codewitch
      wrote on last edited by
      #11

      C# requires a VM. C does not.

      I wrote that. I can defend it. The CLI is a virtual machine. Its instruction set is IL. Its runtimes are the CLR.

      Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

      0 1 Reply Last reply
      0
      • M Member_16280786

        Hey everyone, I've been diving into C# .NET recently and I couldn't help but notice some similarities with C programming. I'm curious about how much C programming principles influence C# .NET and how understanding C might help in mastering C#. Key Points of Discussion: Syntax and Basic Constructs: C# shares many basic syntax elements with C, such as data types (int, char, float), control structures (if, for, while), and operators (+, -, *, /). How much does familiarity with these elements in C help when learning C#? Memory Management: C provides manual memory management using malloc and free, whereas C# handles memory through garbage collection. How does this difference impact the way we write and optimize code in C# compared to C? Pointers and References: While C heavily relies on pointers, C# abstracts memory management but still allows the use of pointers in an unsafe context. How relevant are C pointers when dealing with C# programming, especially in performance-critical applications? Object-Oriented Programming: C# is inherently object-oriented, unlike C. For those coming from a C background, how challenging is it to grasp the object-oriented concepts in C#? How can C principles aid in understanding these concepts? Platform Independence: C# through .NET Core aims to be platform-independent, much like C programs can be compiled on various platforms. What are the key differences in achieving platform independence between the two languages? Use Cases and Applications: C is often used for system-level programming and embedded systems, while C# is popular for web applications, desktop applications, and game development using Unity. How do these different use cases affect the choice of language and the transition from C to C#? Your Experiences and Insights: I’d love to hear from those of you who have experience in both C and C#. How did your knowledge of C help (or not help) you when learning C#? Are there specific areas where you felt a strong correlation or significant differences? Any tips for someone coming from a C background and looking to excel in C# .NET? Looking forward to an engaging discussion! Cheers, Tejaswini

        N Offline
        N Offline
        Nelek
        wrote on last edited by
        #12

        As an old member here answered once... Do not forget that my compiler compiled your compiler.

        M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.

        P 1 Reply Last reply
        0
        • H honey the codewitch

          C# requires a VM. C does not.

          I wrote that. I can defend it. The CLI is a virtual machine. Its instruction set is IL. Its runtimes are the CLR.

          Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

          0 Offline
          0 Offline
          0x01AA
          wrote on last edited by
          #13

          But it will compile finally to the target machine native processor code

          H 1 Reply Last reply
          0
          • 0 0x01AA

            But it will compile finally to the target machine native processor code

            H Offline
            H Offline
            honey the codewitch
            wrote on last edited by
            #14

            It's JIT compiled, which is an implementation detail of the VM, similar to javascript on a modern browser. Furthermore, setting aside that, it still cannot manage memory without the CLI, even compiled to native code. It requires the virtual machine in order to do basic operations. That machine is not simply part of the run time library like C's heap stuff. It's garbage collected - a process.

            Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

            K 1 Reply Last reply
            0
            • N Nelek

              As an old member here answered once... Do not forget that my compiler compiled your compiler.

              M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.

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

              A proper C compiler is implemented in C and compiles itself. :cool:

              T 1 Reply Last reply
              0
              • J jochance

                My opinion is that if you learn any programming language at all then you have learned 50% of all of them, arbitrary percentages notwithstanding. It's more "true" if we subdivide into things like functional vs OOP languages. A loop is a loop, the core of just about every data structure tend be an array, a hashmap is a hashmap, race conditions, resource contention, thread safety, cyclomatic complexity, atomicity... All these concepts and a great many more are going to exist no matter what language you are working in. This is part of the argument I think I have read before which posits that multilingual people tend to pick up programming a bit easier and already have the neurons knocking around upstairs in much an order suitable. This makes sense because programming is just the language we use to command machines. There are/can be vast differences and the nuances do often matter. But the concepts - those bits that help you understand what matters and what does not? These are very universal.

                J Offline
                J Offline
                jmaida
                wrote on last edited by
                #16

                I agree. Having been through a Fortran, Cobol, PL/I, C cycle, the baby steps for each were fewer and fewer as one transitioned.

                "A little time, a little trouble, your better day" Badfinger

                1 Reply Last reply
                0
                • H honey the codewitch

                  I don't think of them as much the same. They're both C family so the syntax is similar, but that's about where the similarities end. The datatypes for example, appear the same but they are not. A C int is not equivalent to a C# concept of an int as C's word size is not fixed, but varies by machine. Floats and doubles are the same but that probably has as much to do with IEEE as anything. Using pointers in C# raises the question of why not use C? More importantly, the unsafe context only works on code that is fully trusted, greatly limiting where and how it can be deployed. There's almost nothing you can do with unsafe that you can't do with the marshalling infrastructure. Finally, using pointers often harms GC performance because you have to pin memory addresses so they don't get relocated during a collection. I don't know how hard it is to grasp OOP. I picked it up in the 1980s. It has been too long, but I don't remember it being especially difficult - particularly once you understand how C++ implements classes and that you can make virtually the same constructs in C, just more verbose. C is cross compatible source code. C# is cross compatible binary code. C# requires a VM. C does not. C runs in far more places - places where C# will never run.

                  Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                  J Offline
                  J Offline
                  jmaida
                  wrote on last edited by
                  #17

                  Well said. Good words.

                  "A little time, a little trouble, your better day" Badfinger

                  1 Reply Last reply
                  0
                  • M Member_16280786

                    Hey everyone, I've been diving into C# .NET recently and I couldn't help but notice some similarities with C programming. I'm curious about how much C programming principles influence C# .NET and how understanding C might help in mastering C#. Key Points of Discussion: Syntax and Basic Constructs: C# shares many basic syntax elements with C, such as data types (int, char, float), control structures (if, for, while), and operators (+, -, *, /). How much does familiarity with these elements in C help when learning C#? Memory Management: C provides manual memory management using malloc and free, whereas C# handles memory through garbage collection. How does this difference impact the way we write and optimize code in C# compared to C? Pointers and References: While C heavily relies on pointers, C# abstracts memory management but still allows the use of pointers in an unsafe context. How relevant are C pointers when dealing with C# programming, especially in performance-critical applications? Object-Oriented Programming: C# is inherently object-oriented, unlike C. For those coming from a C background, how challenging is it to grasp the object-oriented concepts in C#? How can C principles aid in understanding these concepts? Platform Independence: C# through .NET Core aims to be platform-independent, much like C programs can be compiled on various platforms. What are the key differences in achieving platform independence between the two languages? Use Cases and Applications: C is often used for system-level programming and embedded systems, while C# is popular for web applications, desktop applications, and game development using Unity. How do these different use cases affect the choice of language and the transition from C to C#? Your Experiences and Insights: I’d love to hear from those of you who have experience in both C and C#. How did your knowledge of C help (or not help) you when learning C#? Are there specific areas where you felt a strong correlation or significant differences? Any tips for someone coming from a C background and looking to excel in C# .NET? Looking forward to an engaging discussion! Cheers, Tejaswini

                    F Offline
                    F Offline
                    Fly Gheorghe
                    wrote on last edited by
                    #18

                    You can end any initializer list and enumeration with a comma, just as in C. ... = { 1, 2, 3, }; Dennis M. Ritchie (may God rest his soul in peace) wrote that he was always forgetting to include a comma at the end of a row, when editing/extending such a list, and therefore changed the underlying grammar so that the C compiler accepts a last comma. 40 years later and many derived languages, nobody dared to change this. It would be interesting to check if this syntax still applies to "modern" languages like JavaScript, Rust etc.

                    1 Reply Last reply
                    0
                    • P PIEBALDconsult

                      A proper C compiler is implemented in C and compiles itself. :cool:

                      T Offline
                      T Offline
                      trønderen
                      wrote on last edited by
                      #19

                      Doesn't that hold for the great majority of languges/compilers since around 1970? Usually you need to create a small bootstrap in some other language. I was told (so I have no URL to back it up) that Nick Wirth attempted to write a compiler for the very first, super simple core Pascal (1970) in Fortran, but gave up and reverted to assembler - I don't know for which machine. Once this was running, all following extensions to full Pascal was written in the simpler Pascal dialect, as is the common strategy for all language/compiler bootstrapping. I guess that languages deviating a lot from the algorithmic style (such as APL, Prolog, SNOBOL, Lisp, ...) have compilers / interpreters written in other languages, at least for production work. (I would be sort of surprised if no APL programmer has written an APL interpreter in APL!) But for the algorithmic languages group, the great majority have compilers expressed in themselves. This, of course, does not prohibit compilers written in other languages - I guess one main reason for that is that the compiler developer knows C only. I know of one case where no bootstrapping in another language was required: The compiler was written in itself. Its developer put the compiler source up on the document holder by his keyboard, and compiled each statement in his head, typing in the machine instructions he knew that the compiler would generate. Of course he knew - he had written the compiler! This was in 1974. Admittedly, this was a rather simple language - abstraction level was lower than K&R C. Yet it illustrates the principle of writing a compiler in its own language.

                      Religious freedom is the freedom to say that two plus two make five.

                      N J 2 Replies Last reply
                      0
                      • M Member_16280786

                        Hey everyone, I've been diving into C# .NET recently and I couldn't help but notice some similarities with C programming. I'm curious about how much C programming principles influence C# .NET and how understanding C might help in mastering C#. Key Points of Discussion: Syntax and Basic Constructs: C# shares many basic syntax elements with C, such as data types (int, char, float), control structures (if, for, while), and operators (+, -, *, /). How much does familiarity with these elements in C help when learning C#? Memory Management: C provides manual memory management using malloc and free, whereas C# handles memory through garbage collection. How does this difference impact the way we write and optimize code in C# compared to C? Pointers and References: While C heavily relies on pointers, C# abstracts memory management but still allows the use of pointers in an unsafe context. How relevant are C pointers when dealing with C# programming, especially in performance-critical applications? Object-Oriented Programming: C# is inherently object-oriented, unlike C. For those coming from a C background, how challenging is it to grasp the object-oriented concepts in C#? How can C principles aid in understanding these concepts? Platform Independence: C# through .NET Core aims to be platform-independent, much like C programs can be compiled on various platforms. What are the key differences in achieving platform independence between the two languages? Use Cases and Applications: C is often used for system-level programming and embedded systems, while C# is popular for web applications, desktop applications, and game development using Unity. How do these different use cases affect the choice of language and the transition from C to C#? Your Experiences and Insights: I’d love to hear from those of you who have experience in both C and C#. How did your knowledge of C help (or not help) you when learning C#? Are there specific areas where you felt a strong correlation or significant differences? Any tips for someone coming from a C background and looking to excel in C# .NET? Looking forward to an engaging discussion! Cheers, Tejaswini

                        J Offline
                        J Offline
                        JohaViss61
                        wrote on last edited by
                        #20

                        I learned C# many years ago coming from a Delphi background. I found C# not that different from Delphi if you substitute begin and end with { and } After all they were both developed by the same person. (Anders Hejlsberg - Wikipedia[^])

                        1 Reply Last reply
                        0
                        • K Kschuler

                          ...this feels like a test. Are you trying to get us to do your homework?

                          S Offline
                          S Offline
                          Steve Naidamast
                          wrote on last edited by
                          #21

                          C# is merely VB.NET with some steroids added...

                          Steve Naidamast Sr. Software Engineer Black Falcon Software, Inc. blackfalconsoftware@outlook.com

                          1 Reply Last reply
                          0
                          • H honey the codewitch

                            It's JIT compiled, which is an implementation detail of the VM, similar to javascript on a modern browser. Furthermore, setting aside that, it still cannot manage memory without the CLI, even compiled to native code. It requires the virtual machine in order to do basic operations. That machine is not simply part of the run time library like C's heap stuff. It's garbage collected - a process.

                            Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                            K Offline
                            K Offline
                            klinkenbecker
                            wrote on last edited by
                            #22

                            honey the codewitch wrote:

                            it still cannot manage memory without the CLI

                            This, along with some other 'limitations', is a limitation of the runtime, not the language. And in relation to compiling, there is nothing in the language that prevents it being compiled. =:)

                            1 Reply Last reply
                            0
                            • T trønderen

                              Doesn't that hold for the great majority of languges/compilers since around 1970? Usually you need to create a small bootstrap in some other language. I was told (so I have no URL to back it up) that Nick Wirth attempted to write a compiler for the very first, super simple core Pascal (1970) in Fortran, but gave up and reverted to assembler - I don't know for which machine. Once this was running, all following extensions to full Pascal was written in the simpler Pascal dialect, as is the common strategy for all language/compiler bootstrapping. I guess that languages deviating a lot from the algorithmic style (such as APL, Prolog, SNOBOL, Lisp, ...) have compilers / interpreters written in other languages, at least for production work. (I would be sort of surprised if no APL programmer has written an APL interpreter in APL!) But for the algorithmic languages group, the great majority have compilers expressed in themselves. This, of course, does not prohibit compilers written in other languages - I guess one main reason for that is that the compiler developer knows C only. I know of one case where no bootstrapping in another language was required: The compiler was written in itself. Its developer put the compiler source up on the document holder by his keyboard, and compiled each statement in his head, typing in the machine instructions he knew that the compiler would generate. Of course he knew - he had written the compiler! This was in 1974. Admittedly, this was a rather simple language - abstraction level was lower than K&R C. Yet it illustrates the principle of writing a compiler in its own language.

                              Religious freedom is the freedom to say that two plus two make five.

                              N Offline
                              N Offline
                              Norm Powroz
                              wrote on last edited by
                              #23

                              To the best of my knowledge, the Multics PL/1 compiler was pretty much entirely written in PL/1. Of course, so was the great majority of the Multics operating system, from which sprung that which was called UNIX (formerly UNICS, a play on the Multics name). In other, older, systems, compilers were quite often written entirely in the assembler of the host/target machine. I remember poring through the source of a COBOL-68 compiler trying to find a solution to what I thought was a rather stupid bug in the parser. The entire compiler was written in assembler, and printed out the source was over a foot thick.

                              1 Reply Last reply
                              0
                              • M Member_16280786

                                Hey everyone, I've been diving into C# .NET recently and I couldn't help but notice some similarities with C programming. I'm curious about how much C programming principles influence C# .NET and how understanding C might help in mastering C#. Key Points of Discussion: Syntax and Basic Constructs: C# shares many basic syntax elements with C, such as data types (int, char, float), control structures (if, for, while), and operators (+, -, *, /). How much does familiarity with these elements in C help when learning C#? Memory Management: C provides manual memory management using malloc and free, whereas C# handles memory through garbage collection. How does this difference impact the way we write and optimize code in C# compared to C? Pointers and References: While C heavily relies on pointers, C# abstracts memory management but still allows the use of pointers in an unsafe context. How relevant are C pointers when dealing with C# programming, especially in performance-critical applications? Object-Oriented Programming: C# is inherently object-oriented, unlike C. For those coming from a C background, how challenging is it to grasp the object-oriented concepts in C#? How can C principles aid in understanding these concepts? Platform Independence: C# through .NET Core aims to be platform-independent, much like C programs can be compiled on various platforms. What are the key differences in achieving platform independence between the two languages? Use Cases and Applications: C is often used for system-level programming and embedded systems, while C# is popular for web applications, desktop applications, and game development using Unity. How do these different use cases affect the choice of language and the transition from C to C#? Your Experiences and Insights: I’d love to hear from those of you who have experience in both C and C#. How did your knowledge of C help (or not help) you when learning C#? Are there specific areas where you felt a strong correlation or significant differences? Any tips for someone coming from a C background and looking to excel in C# .NET? Looking forward to an engaging discussion! Cheers, Tejaswini

                                Z Offline
                                Z Offline
                                zezba9000
                                wrote on last edited by
                                #24

                                C# also supports pointers, malloc/free as well. The Roslyn compiler supports code-generators, IDE analyzers, etc. C# is a much more productive & powerful language for most tasks. C is like portable ASM and is great to make component libs in.

                                T 1 Reply Last reply
                                0
                                • M Member_16280786

                                  Hey everyone, I've been diving into C# .NET recently and I couldn't help but notice some similarities with C programming. I'm curious about how much C programming principles influence C# .NET and how understanding C might help in mastering C#. Key Points of Discussion: Syntax and Basic Constructs: C# shares many basic syntax elements with C, such as data types (int, char, float), control structures (if, for, while), and operators (+, -, *, /). How much does familiarity with these elements in C help when learning C#? Memory Management: C provides manual memory management using malloc and free, whereas C# handles memory through garbage collection. How does this difference impact the way we write and optimize code in C# compared to C? Pointers and References: While C heavily relies on pointers, C# abstracts memory management but still allows the use of pointers in an unsafe context. How relevant are C pointers when dealing with C# programming, especially in performance-critical applications? Object-Oriented Programming: C# is inherently object-oriented, unlike C. For those coming from a C background, how challenging is it to grasp the object-oriented concepts in C#? How can C principles aid in understanding these concepts? Platform Independence: C# through .NET Core aims to be platform-independent, much like C programs can be compiled on various platforms. What are the key differences in achieving platform independence between the two languages? Use Cases and Applications: C is often used for system-level programming and embedded systems, while C# is popular for web applications, desktop applications, and game development using Unity. How do these different use cases affect the choice of language and the transition from C to C#? Your Experiences and Insights: I’d love to hear from those of you who have experience in both C and C#. How did your knowledge of C help (or not help) you when learning C#? Are there specific areas where you felt a strong correlation or significant differences? Any tips for someone coming from a C background and looking to excel in C# .NET? Looking forward to an engaging discussion! Cheers, Tejaswini

                                  J Offline
                                  J Offline
                                  Jalapeno Bob
                                  wrote on last edited by
                                  #25

                                  As I remember it, C was the new kid on the block when I got out of college, designed and developed for the new UNIX operating system being promulgated by the Bell Telephone Company. Unlike FORTRAN, COBOL, and PL/1, each line of code compiled into only a few assembler instructions. But it had it's shortcomings. Because of the lack of strong typing and need to use explicit pointers, it was also an error prone language. Programmers had to really understand the hardware and how to use pointers effectively.

                                  Advances in language theory and the advent of visual interfaces, such as Vermont Views, Windows, and OS/2, C was enhanced with strong typing, creating C++, and the Windows Forms visual UI libraries were added by Microsoft, creating C#.

                                  __________________ Lord, grant me the serenity to accept that there are some things I just can’t keep up with, the determination to keep up with the things I must keep up with, and the wisdom to find a good RSS feed from someone who keeps up with what I’d like to, but just don’t have the damn bandwidth to handle right now. © 2009, Rex Hammock

                                  1 Reply Last reply
                                  0
                                  • Z zezba9000

                                    C# also supports pointers, malloc/free as well. The Roslyn compiler supports code-generators, IDE analyzers, etc. C# is a much more productive & powerful language for most tasks. C is like portable ASM and is great to make component libs in.

                                    T Offline
                                    T Offline
                                    trønderen
                                    wrote on last edited by
                                    #26

                                    zezba9000 wrote:

                                    C# also supports pointers, malloc/free as well.

                                    If those are significant elements in your C# programming, I think you should consider returning back to C++.

                                    Religious freedom is the freedom to say that two plus two make five.

                                    Z 2 Replies Last reply
                                    0
                                    • J jochance

                                      My opinion is that if you learn any programming language at all then you have learned 50% of all of them, arbitrary percentages notwithstanding. It's more "true" if we subdivide into things like functional vs OOP languages. A loop is a loop, the core of just about every data structure tend be an array, a hashmap is a hashmap, race conditions, resource contention, thread safety, cyclomatic complexity, atomicity... All these concepts and a great many more are going to exist no matter what language you are working in. This is part of the argument I think I have read before which posits that multilingual people tend to pick up programming a bit easier and already have the neurons knocking around upstairs in much an order suitable. This makes sense because programming is just the language we use to command machines. There are/can be vast differences and the nuances do often matter. But the concepts - those bits that help you understand what matters and what does not? These are very universal.

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

                                      Well except for pure Lisp maybe. That one always seemed way different to me.

                                      J 1 Reply Last reply
                                      0
                                      • T trønderen

                                        Doesn't that hold for the great majority of languges/compilers since around 1970? Usually you need to create a small bootstrap in some other language. I was told (so I have no URL to back it up) that Nick Wirth attempted to write a compiler for the very first, super simple core Pascal (1970) in Fortran, but gave up and reverted to assembler - I don't know for which machine. Once this was running, all following extensions to full Pascal was written in the simpler Pascal dialect, as is the common strategy for all language/compiler bootstrapping. I guess that languages deviating a lot from the algorithmic style (such as APL, Prolog, SNOBOL, Lisp, ...) have compilers / interpreters written in other languages, at least for production work. (I would be sort of surprised if no APL programmer has written an APL interpreter in APL!) But for the algorithmic languages group, the great majority have compilers expressed in themselves. This, of course, does not prohibit compilers written in other languages - I guess one main reason for that is that the compiler developer knows C only. I know of one case where no bootstrapping in another language was required: The compiler was written in itself. Its developer put the compiler source up on the document holder by his keyboard, and compiled each statement in his head, typing in the machine instructions he knew that the compiler would generate. Of course he knew - he had written the compiler! This was in 1974. Admittedly, this was a rather simple language - abstraction level was lower than K&R C. Yet it illustrates the principle of writing a compiler in its own language.

                                        Religious freedom is the freedom to say that two plus two make five.

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

                                        trønderen wrote:

                                        I know of one case where no bootstrapping in another language was required:

                                        The Forth Language, at least as originally created, was written like that. It requires a stack and very little beyond that.

                                        1 Reply Last reply
                                        0
                                        • M Member_16280786

                                          Hey everyone, I've been diving into C# .NET recently and I couldn't help but notice some similarities with C programming. I'm curious about how much C programming principles influence C# .NET and how understanding C might help in mastering C#. Key Points of Discussion: Syntax and Basic Constructs: C# shares many basic syntax elements with C, such as data types (int, char, float), control structures (if, for, while), and operators (+, -, *, /). How much does familiarity with these elements in C help when learning C#? Memory Management: C provides manual memory management using malloc and free, whereas C# handles memory through garbage collection. How does this difference impact the way we write and optimize code in C# compared to C? Pointers and References: While C heavily relies on pointers, C# abstracts memory management but still allows the use of pointers in an unsafe context. How relevant are C pointers when dealing with C# programming, especially in performance-critical applications? Object-Oriented Programming: C# is inherently object-oriented, unlike C. For those coming from a C background, how challenging is it to grasp the object-oriented concepts in C#? How can C principles aid in understanding these concepts? Platform Independence: C# through .NET Core aims to be platform-independent, much like C programs can be compiled on various platforms. What are the key differences in achieving platform independence between the two languages? Use Cases and Applications: C is often used for system-level programming and embedded systems, while C# is popular for web applications, desktop applications, and game development using Unity. How do these different use cases affect the choice of language and the transition from C to C#? Your Experiences and Insights: I’d love to hear from those of you who have experience in both C and C#. How did your knowledge of C help (or not help) you when learning C#? Are there specific areas where you felt a strong correlation or significant differences? Any tips for someone coming from a C background and looking to excel in C# .NET? Looking forward to an engaging discussion! Cheers, Tejaswini

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

                                          Member 16280786 wrote:

                                          how understanding C might help in mastering C#.

                                          It isn't that simple. If you can program a simple program in C then you can likely write the same one in C#. But the concepts to create viable enterprise systems are not language specific.

                                          Member 16280786 wrote:

                                          C# shares many basic syntax elements with C, such as data types (int, char, float), control structures (if, for, while), and operators (+, -, *, /). How much does familiarity with these elements in C help when learning C#?

                                          That question resolves around my first point. If you know those well from C then it has no impact in learning C#. If you don't know them then you would still need to learn them regardless of which language you learn.

                                          Member 16280786 wrote:

                                          C provides manual memory management using malloc and free, whereas C# handles memory through garbage collection. How does this difference impact the way we write and optimize code in C# compared to C?

                                          Quite a bit.

                                          Member 16280786 wrote:

                                          While C heavily relies on pointers, C# abstracts memory management but still allows the use of pointers in an unsafe context. How relevant are C pointers when dealing with C# programming, especially in performance-critical applications?

                                          Unmanaged code does not matter much in enterprise systems because it isn't used. Even when use cases exist they represent a very small percentage of the overall code base. However the question is simplistic because for a beginning programmer the concept of 'pointing to' is not that easy of a concept to grasp and use. That is why linked lists are often an early topic in teaching. And that concept still exists in C#.

                                          Member 16280786 wrote:

                                          C# is inherently object-oriented, unlike C. For those coming from a C background, how challenging is it to grasp the object-oriented concepts in C#? How can C principles aid in understanding these concepts?

                                          It is a significant problem. Structured programming and Object Oriented Programming requires different designs not just code. C programmers that move to any OO language will often end up creating designs that reflect structured programming rather than OO. I suspect going from OO to structured is quite difficult as well. As a well known

                                          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