Now that C++11 is beginning to appear in popular compilers, C is becoming less relevant. C is now useful only to kernel writers and embedded systems programmers. You will not achieve employment with C as long as C++11 exists.
Prepare your anus.
Name:
Anonymous2012-07-10 0:36
I agree, although C++ can and is widely used in embedded systems.
Name:
Anonymous2012-07-10 0:47
If anything will make C obsolete it is Go (C with garbage collection). Its only a matter of time before D makes C++ obsolete as programmers realise that having to manuallyt manage memory in C++ is a waste of time
>>3 having to manuallyt manage memory in C++ is a waste of time
- There are many third party garbage collectors for C++.
- These GCs are rarely used because RAII is more efficient than GC and easy to use.
- Smart pointers are now standard in the C++11 STL, although Boost has had them for a decade. In particular shared_ptr uses reference counting to avoid the need to explicitly delete. For 90% of code where the STL is permitted, you can get away with always using shared_ptr.
- Valgrind, Dr. Memory, and countless other tools make it very difficult to mess up memory management.
Name:
Anonymous2012-07-10 1:26
>>4
thanks for reminding me how much I hate trying to make C++ safe and motivating me to use D
>>7
thats a pretty lame ass attempt to shoot down D: Unicode is dealt with in a somewhat strange way - there are three different unicode string types: char[], wchar[] and dchar[] - the standard is char[]
boo hoo, sry you dont like unicode
>Arrays are strange. Some are static, some are dynamic.
as opposed to what? C++ arrays that are static pointers? having to turn arrays into objects so you can make them dynamic in C++?
Arrays are not regular objects
see above, enjoy your buffer overflows with regular non-bounds checked arrays in C++
You can sometimes call methods without the parens.
ooooh, thats a deal breaker
Functions that form closures or are attached to objects (i.e. methods) are not the same as regular functions, instead they are called delegates, and you must be aware of the differences.
seriously, this is a ~bad~ part of D compared to C++?
>Literal strings (char[]) can be defined with x"40fe", to specify the bytes in hexadecimal that make up the utf-8 array. The D website says that specifying an illegal utf-8 sequence is allowed, but my compiler disagrees.
boo hoo, compare that to how C++ handles utf-8
Im not going to go through the rest, you get the idea, its pretty pathetic to see C++ programmers try to shoot down D especially when the only way to make C++ more dynamic is on top of generics bullshit
>>5
Really? It's not that hard to design and/or use thread/exception/leak safe interfaces in C++. D is unnecessary if your only concern is safety. C++ by default is unsafe, but it gives you the tools to easily switch to a safe design if you're at least an intermediate.
Literally everything in D is also possible with C++. Sure, maybe one feature here or there is better than C++, but there's no major compelling reason for the world to switch.
Also Walter Bright's D compiler is written in C++.
Name:
Anonymous2012-07-10 14:25
It's not that hard to design and/or use thread/exception/leak safe interfaces in C++.
then why arent there any books that teach how to program 'safe C++'? You cant teach safe C/C++ for the same reason you cant teach safe OS systems administration, its something you can only learn with experience. The fact is there is no cookie-cutter method for making safe C++ code, you simply have to have a deep understanding of low level architecture, assembly, OS and libs, etc, everything a CS student would be expected to know. Which is why only CS graduates are the ones who like and are able to use C/C++ safely. After many wasted years of trying to learn C/C++ Ive realized all that time is wasted, I could have used D and gotten the exact same results as far as speed and low memory use. The things that C/C++ offer is of very little use to the average applications programmer.
Name:
Anonymous2012-07-10 15:03
>>15
to further this point: the only thing that C/C++ gives you is control, you have much more direct control of how the compiler interprets bytes in C/C++ than any other languagge. But that control comes at a cost of diligence, the programmer is expected to watch over things that the compiler would normally control in other languages. This is hard to do and is why that coding standards are put in place in places like MS to try and keep all the dangers of buffer overflows in check. But its a losing battle, eventually people are going to use D and Go more instead of fighting to control C/C++. I predict that as soon as a AAA game studio produces a major 3D game in D, that will kill C++'s percieved advantage and relegate C/C++ to systems programming forever
>>19
nope, I dont use VM languages, surprise, you can get garbage collection with compiled languages
Name:
Anonymous2012-07-10 18:54
I predict that as soon as a AAA game studio produces a major 3D game in D, that will kill C++'s percieved advantage and relegate C/C++ to systems programming forever
D is an experimental language. No one will use it for production. It's for open sores shitcode until Intel and Microsoft make compilers for it.
Name:
Anonymous2012-07-10 22:20
dubs get
Name:
Anonymous2012-07-11 0:35
C++11 should be used for kernels too. C is only relevant for embedded programming.
Name:
Anonymous2012-07-11 2:48
[quote]C++11 should be used for kernels too. C is only relevant for embedded programming.[/quote]
Linus Torvald once said in an email that he tried to use sepples in the kernel before, but then he realized everything quickly turned into shit.
>>24
oh boy, like we havent seen that 'email' a thousand times before, why dont you post a link of it so we can all admire Linus's keen insight
Name:
Anonymous2012-07-11 4:57
>>23
So the kernel should include the entire C++ runtime, including RTTI, cxxabi and the like? Now for an even more fun question: are you gonna use the C ABI for module loading?
If you're writing a microkernel, that's gonna be one huge microkernel
Name:
Anonymous2012-07-11 5:05
>>26
A microkernel should be so small that it should be ok to do it in C++.
>>26
I dont know why you are making a big thing about an ABI, an OS is bare metal systems programming, an OS does not run on an OS. The Linux kernel has its own object system, which is kind of funny considering that Linus's only legitimate gripe about C++ is depending on high level abstractions that cant be removed, yet he himself creates such abstractions from scratch in C. One OS that does use C++ is Symbian, and considering that Symbian is an extremely light weight OS meant to run on extremely low power hardware proves that C++ is up to the job.
Name:
Anonymous2012-07-11 13:20
"Manually manage memory" is a clever troll which you might or might not realize.
When do you have to manage memory if it is not dynamic and when is physical memory available dynamic in a production server at runtime? That's never. So it is a non issue. A buyer hoarding system out of your control, in what way is that your problem? Cargo cult programming, that's what it is. Completely useless and very harmful.
All you got from this useless cargo cult programming was a world wide distribution of systems that are unable to answer simple questions such as, "how many X can be processed in a period of Y".
Really, take any system, why not 4chan as an example. What are the limits? You'll get nothing but estimates as answers because they are unknown due to non existing limits!
This is useless in a business world, which pays your bills, if there are systems available that actually can answer these questions. Systems that comes with a guarantee that, you'll get what you pay for period, nothing more and nothing less. Neither the buyer or the seller have any doubts, X of these and Z of that. Easily accomplished by either system profiling at startup or configs, memory benchmarks at startup and heap allocation. If performance is not guaranteed as determined by benchmarks, log and fail, blaim the buyer for misuse - cash in support.
Seriously, name one bill paying use for dynamic memory usage and where it counts. If none, why aren't you learning how to do without it?
That's just my cents, from the lead developer of a system that currently rapes competing systems around the world...
>>28 Linus's only legitimate gripe about C++ is depending on high level abstractions that cant be removed, yet he himself creates such abstractions from scratch in C
That's common among C and "C+" programmers. For example, they complain that templates produce executable bloat, but they end up bloating it manually with new functions for every type or worse, massive preprocessor blocks.
Name:
Anonymous2012-07-12 17:46
>>29
Are you honestly saying there isn't a need for dynamic memory?
Name:
Anonymous2012-07-12 18:42
How about this: C/C+/C++ are fucking shit.
Name:
Anonymous2012-07-12 20:38
>>31
I think he's saying something akin to "every program has an obvious ceiling that is defined by the task it is designed to perform within the constraints it is designed to respect within a degree of performance it is expected to represent."
>>43
Windows is actually a pretty capable OS. Don't even mention supercomputers or headless servers as though that is any mark against Windows in its preferred use case.
Name:
Anonymous2012-07-13 16:17
>>44
It's non-free, sonny. Can you really trust a US-based company?
>>47
And you are either a Chinese citizen or a commie.
Name:
Anonymous2012-07-13 17:48
>>42 the only CIA-backdoor-free OS.
confirmed for tinfoil hat neckbeard basement dweller. you have no idea what OS security is or how it is maintained. you think a toy OS made by a fellow neckbeard makes you impervious to security threats
we got sweating white trash fail going on here
Name:
Anonymous2012-07-13 17:51
>>48
Neither. Also, your McCarthyist stupidity is showing.
It is not necessary, but a need? When do you need to use dynamic allocation? To allocate memory for a popup dialog that says memory allocation failed? I bet you do allocate memory for dialogs, am I right? That's only a need to make up for shoddy programming skills and that's ok with me, as long it's not me doing it. Maybe another examples calls for dynamic allocation. Let's say you open 25000 images in photoshop, oh no, bad example...it would be better if photoshop limited the amount of memory to use by a setting, I wouldn't want to know what would happen if photoshop tries to 25K images, would it crash, would my unsaved work be saved?
Your turn, give an example where it is a good idea.
Name:
Anonymous2012-07-14 8:27
One moment a chunk of ram can be a cudder, next it can be a 2hu. ~ ~ The miracles of computer science in a modern age ~ ~
That's a bad reason, if you can not know how much resources that will be needed in theory (as in it's impossible), you should at least limit any hoarding of resources to sensical limits. If not, your little app could swap out the entire system. Still lazy, you should rather let it be configurable by the user. Then if doing that then it makes sense to allocate it all on the heap directly and make sure it's locked in physical memory, to guarantee that the resources a user has configured your program to handle, actually has been acquired and can be used.
Name:
Anonymous2012-07-14 12:57
>>26
The most important L4 implementations are written in C++.
>>55
There are too many cases where you need dynamic memory allocation/freeing. Let's say you need to load a resource into memory, do something with it, and then remove it from memory. Use your fucking imagination. Sage.