How is c different from c
It becomes when you need to create threads which are supposed to be "private" to the classes so that they have access to private members. Certain language features, even if they are additions, can change the whole way the language practically needs to be used. As one example consider this case:. RAII becomes a practical requirement because it's not humanly feasible to anticipate every single line of code that can throw in non-trivial examples not to mention that those lines may not throw now but may later with changes.
Take another example:. These languages require a very different mindset, discipline, and way of thinking to use most effectively. I really love minimalism as an attractive feature of a library for those who take the extra time to seek such qualities, and perhaps C tends to encourage that, if only by the virtue of the fact that such large and layered and abstract code would be a real PITA to develop in C.
But sometimes when you go really low-level, like to the level of a memory allocator or very low-level data structure and I'm sure there are further examples among those who do embedded programming , it can sometimes be helpful to be able to assume that the types and data you're working with are absent certain features like vtables, costructors, and destructors, so that we can treat them as bits and bytes to shuffle around, copy, free, reallocate.
For very particularly low-level problems, it can sometimes be helpful to work with a much simpler type system that C provides, and of course it tends to build faster and so forth. One interesting comment here I wanted to respond to a bit more in depth I find the comments here are so strict on character limit :. One of the reasons such x-rayish byte-copying memcpy or qsort types of functions pose less of a practical danger in C is that the destruction of f1 and f2 above are explicit if they even need non-trivial destruction , whereas when destructors move into the picture, they become implicit and automated often with great value to the developers.
That's not to even mention hidden state like vptrs and so forth which such functions would bulldoze right over. If f1 owns pointers and f2 shallow copies them in some temporary context, then it poses no problem if we do not try to explicitly free those owning pointers a second time.
X-raying C types and treating them as bits and bytes is error-prone. That is actually the biggest appeal to me of C, however, specifically with how it relates to language interoperability. With C it's a relatively dumber language that has become rather standard as far as APIs in ways that many different languages can import directly through FFIs, or indirectly through some C API exporting functions in a desired form ex: Java Native Interface.
But you know, I'm a pragmatist or at least I strive to be. And I don't find that. At least whatever hurdles the language poses does not seem to pose impasses as far as writing some cool libraries and products in competent hands, and that's really all I'm interested in. So I've never been the type so interested in the most passionate language wars, except to make a pragmatic appeal and say, "Hey, there's cool stuff out there!
Let's learn how they made it and maybe there are cool lessons, not so specific to the idiomatic nature of the language, that we can bring back to whatever language s we're using. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. Ask Question. Asked 10 years, 9 months ago. Active 10 months ago.
Viewed 46k times. Improve this question. Joshua Partogi Joshua Partogi 3, 10 10 gold badges 32 32 silver badges 41 41 bronze badges. Due to how they are used. Add a comment. Active Oldest Votes. Improve this answer. Next Continue. Home Testing Expand child menu Expand. SAP Expand child menu Expand. Web Expand child menu Expand. Must Learn Expand child menu Expand. Big Data Expand child menu Expand. Live Project Expand child menu Expand. AI Expand child menu Expand. Toggle Menu Close. Search for: Search.
Most old-school programmers will suggest that C is the best programming language to start with because so many newer languages build off of it. It may also offer some security benefits because of its age.
The pool of people using it is smaller, making it a less desirable target for hackers. It was created by a Ph. His goal was to enhance C and add object-oriented programming capabilities without sacrificing speed or efficiency. Photo credit to Pinterest. It was developed by a team at Microsoft lead by Anders Hejlsberg in NET framework, but its backbone is still clearly the C language.
C compiles into byte-code, rather than machine code. That means it executes on a virtual computer that translates it into machine code on the fly. It adds garbage collection, uninitialized variable checking, bound checking, and type checking capabilities to the base C code. C typically sees use in internal or enterprise applications, rather than commercial software. NET framework. C , on the other hand, has more in common with languages like Java.
Photo credit to Codecondo.
0コメント