Jump to content
xisto Community
Ho-oh'sRealm

Don't You Think C/c++ Is Annoying?

Recommended Posts

Ya I think the standard libc lacks a bunch of functions that would make my life easy, but its not such a hard language once you get use to structures and pointers and pointers to pointers. Though I would never ever ever use this language if I were to try to develop something that didn't require the low level features c has to offer. This is however my language of choice for raw sockets and posix/ipc/threaded programming. Lots of controll over everything.

Share this post


Link to post
Share on other sites

I think coding in C forces you to up your game in programming. The function orientation of the language means you, as the programmer, have to know which function belongs where, instead of object orientation doing it for you. It promotes powerful practices, like memory management, which is done 'for you' with other programming languages. But when we have garbage collectors doing the job for us, we know right off the bat that there will be an overhead. That is to say -- it takes longer for Java to clear our un-linked objects from data than it does for a C program to do it inside of the program itself.I'm not sure how deep you've gone into C program, but you'll run into commands like malloc() and free(). The former sets aside memory to hold an object such that a pointer to it can be passed in and out of functions, while the latter frees it from memory. In Java, you can pass entire objects back and forth and never worry about it, but that's why i think C gives you a better grasp of what's going on underneath the hood.Having programmed in C, you will come across powerful tools like valgrind and gdb that really put your code out into the open regarding your algorithmic errors and other such shortcomings. Not to mention, even without the garbage collecting over-head, C is very much faster than programming languages that run on top of VM's. I remember coding in a combination of C and Assembly for a huge Fibonacci Heap problem, and the speed with which is finishd it over its Java counterpart was impressive.But. If you've ever stared at your terminal wondering why your "Heap" was aborted during a C program, you know that all isn't well in the realm of C xD

Share this post


Link to post
Share on other sites

Is C programming really annoying? If you are trying to get your program to fit within a limited space, I would say that the other languages out there are a lot more annoying because for any bit of code that you write, the equivalent in C is much smaller when compiled. You also get to write your code to take advantage of the way that the hardware runs so you can actually optimize your code to run faster. You know when you need to have access to your data so you can allocate a block of memory and retain a pointer to it just long enough to have what you need and you can then get rid of it. If you look at modern languages, they have a garbage collector to reclaim the memory space that is no longer needed and although it sounds like it would work better, garbage collectors are not all that smart and a lot of programmers building software for embedded devices go crazy when they get out of memory errors because of memory that has not yet been claimed by the garbage collector or if the garbage collection operation takes too long because it works as a deferred process - they would much rather want to have the ability to control when the garbage collection takes place and what gets garbage collection, but then again that is pretty much the same as when they want to allocate memory, have a pointer to it, and then have the memoryr freed and when you look at it, they are actually getting the ability to do all of that with C programming so why would they use any other platform when it fits all of their needs?There is an alternate platform, which is assembly language but then they need to change their code to run on each of the different programming platforms that they are targeting. Imagine writing code once for the Intel line of processors and then having to rewrite it all for running on ARM processors. You don't have to do anything of the sort if you are working with C and stick to the basics. All you would have to do is recompile your code to run on the other development platform and most of your code can be reused.

Share this post


Link to post
Share on other sites

C++ is my favorite language. It fills all my non web needs and I love pointers..

Hey, you forgot references. My favorite part, though, is the templates. Treated pretty awfully by compilers (very inefficient), but make for nice brevity of code...

Share this post


Link to post
Share on other sites

I do like the C programming language because of its simplicity. There is so much that you can do with it and the programs you write using C are more efficient - they run quicker because they don't have all of the runtime checks associated with other programming languages. If you compare C to other programming languages, you will notice that there is very little to learn in comparison. Sure, there's the object oriented development approach that seems to be a better way to structure code, but if you do follow a disciplined approach with structuring your C programs, you can do just about the same with regular C programming by using structures and pointers.C++, on the other hand, is a HUGE language. Firstly, it introduces the concept of inheritance to the C programming language and if that was not enough, there's the standard template library to look up. Also, when you write your programs with C++, they tend to get bloated and it does take longer to run. I believe there was an initial attempt to convert the Linux kernel from C to C++ to take advantage of the object oriented programming paradigm, but it did not quite work out as it was not as responsive as the Linux kernel written in C.The C language is quite powerful, primarily because of the presence of pointers - you can alter the stack or change data in just about any memory location. C++ builds upon C, but you cannot treat it as a perfect superset because there are differences between the C++ and C standards. You can fairly easily tell whether the integrated development environment you are using compiles the code with a C compiler or with a C++ compiler with an understanding of the differences between the standards for C and C++.The advantage that we have with C and C++ is that they are available on just about every platform so you can expect to write a simple C program and re-compile it for a different platform. It is perhaps the reason why we are able to run Linux on multiple platforms by simply re-compiling it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.