Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » C++0x, progress or pointless

This thread is locked; no one can reply to it. rss feed Print
C++0x, progress or pointless
Neil Walker
Member #210
April 2000
avatar

This chap isn't impressed ;)

http://www.theregister.co.uk/2009/05/07/verity_stob_cplusplus/

There are some funny quotes in his other posts:
"The day they change the language name to ++C, that's the day I'll start taking pre-incrementing seriously."

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

axilmar
Member #1,204
April 2001

C++0x is pronounced 'sucks' ;-).

BAF
Member #2,981
December 2002
avatar

I don't know, C++0x looks like a pretty distant reach at this point. I mean {}... seriously? Why not just automatically initialize it like most other sane languages at this point. There's no good reason not to. This is stupid.

anonymous
Member #8025
November 2006

Whining about {}?

#include <stdio.h>

int main()
{
    int n = {0};
    printf("%d", n);
    return 0;
}

This appears to be quite fine in C (you can't omit the 0 though, as you can with arrays).

If it does solve the "most vexing parse" in C++, is it such a bad thing? It's not like it would take days to learn the new initialization syntax...

BAF
Member #2,981
December 2002
avatar

It is stupid and pointless. Why can't it be automatic?

bamccaig
Member #7,536
July 2006
avatar

Thomas Harte
Member #33
April 2000
avatar

I vote pointless. In fact, I expect C and C++ to retreat to the inner sanctums of systems programming and other deep internal stuff — platforms are diverging and C/C++ sits at a suboptimal position in the application development hierarchy for 90% of the code for 99% of applications. C-like languages will thrive, but with either massively improved runtimes (C#, Objective-C) that ease the various binding/fragile base class/etc problems or in areas where code is short and performance is still the major objective (OpenCL, GLSlang/HLSL, device drivers). Even games have been following this path for years, with the C/C++ stuff doing graphics and physics and LUA-or-similar entrusted with all the interesting per-level stuff.

I'm sure it'll be a lengthy transition and C/C++ won't suddenly be irrelevant tomorrow, but I don't see any real worth in attempts to further extend C++ at this stage. Take what works and re-engineer the rest ala C# if you're going to do anything — damn backwards compatibility.

Audric
Member #907
January 2001

I can only imagine it makes sense with templates, as it allows you to initialize a variable of an unknown base type to its own default value.
(that was about {})

BAF
Member #2,981
December 2002
avatar

C# automatically initializes variables, making junk like {} useless. C++0x should do the same if its a serious language. But then you couldn't write major applications in it, so I don't know.

anonymous
Member #8025
November 2006

BAF said:

It is stupid and pointless. Why can't it be automatic?

Because you can expect the revenge of former C programmers? For years they have been promised that there is no extra overhead if they don't want to have their POD initialized at this point. Can you imagine that now when they have been almost won over, C++ can suddenly turn its back to them and bring in that overhead? :)

BAF
Member #2,981
December 2002
avatar

Former C programmers can take a hike then. If they like their ancient archaic crap, they can keep using it. Why limit usefulness of new languages because of the rare case where some masochistic C/asm programmer wants to control when their variable is initialized?

anonymous
Member #8025
November 2006

BAF said:

C# automatically initializes variables, making junk like {} useless.

I have been playing around with C# for a couple of days now, and it seems to me that it is not entirely true. It is an error to try to use uninitialized local variables, though, and since they need to be explicitly initialized, crap like {} (or any other syntax, which is really just a minor detail) is still necessary.

It seems rather stupid to argue which of the two is that much better:

int i{}; //perhaps more obscure but useful with templates
int i = 0;

Audric
Member #907
January 2001

Some people can't work in C# or Python (for example: people who write drivers for hardware.)
I know next to nothing of C++0x, but if it is a new (improved?) tool available for them, I consider it a good thing.

BAF
Member #2,981
December 2002
avatar

How many drivers are written in C++ anyway? I doubt C++0x will be used for drivers.

Timorg
Member #2,028
March 2002

I am sure that GCC will add a bunch of extentions that will allow you to write a mixture of C++98 and C++0x.

____________________________________________________________________________________________
"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

anonymous
Member #8025
November 2006

If I'm not mistaken, the language will be (mostly) backward compatible with the earlier standards. You will be able to write old-style C++ all along, there will just be better ways.

BAF
Member #2,981
December 2002
avatar

Depending on your definition of better. I define better as changing languages all together. :P

Neil Walker
Member #210
April 2000
avatar

If everyone is dead set against c/c++, why are we all (THarte Excepted) writing our allegro games in c/c++ and what are we doing at allegro.cc anyway ;)

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

BAF
Member #2,981
December 2002
avatar

I don't know about you, but I haven't done much game programming at all. I've been using C# almost exclusively for a while now.

bamccaig
Member #7,536
July 2006
avatar

I still prefer C and C++ to C#, actually. C# is the better tool a lot of times simply because it's higher level and has the .NET framework to build from (I don't dare subject myself to Microsoft's managed C++), but there are often times when the power to do something is taken away from me because of the way the language was designed. I've seen and even written, against my own intentions, a lot of really ugly C# code. :P C++ would benefit from a richer standard library and some more syntactic sugar. I think overall C++0x will be a good thing.

anonymous
Member #8025
November 2006

It's supposed to be an attempt to unify the syntax of object construction. You'd use it anytime except when existing constructors would interfere with added constructors. E.g

std::vector<int> vec{4}; //contains one element with value 4
std::vector<int> vec(4); //contains four elements with value 0

Where it is useful?

std::vector<int> vec(std::istream_iterator<int>(std::cin), std::istream_iterator<int>()); //that's called vexing
std::vector<int> vec{std::istream_iterator<int>(std::cin), std::istream_iterator<int>()}; //much better

Thomas Harte
Member #33
April 2000
avatar

If everyone is dead set against c/c++, why are we all (THarte Excepted) writing our allegro games in c/c++ and what are we doing at allegro.cc anyway

I thought you were a C# boy nowadays? And I was also under the impression that a bunch of other people were, quite beside the few I know for certain are in the iPhone Objective-C realm.

Goalie Ca
Member #2,579
July 2002
avatar

There is absolutely no way I will be able to avoid c/c++ in my line of work. The problem with c++0x is that it is too little too late IMO. These things should have been included 10 years ago so I would have a hope of using them by now. By the time code-bases like ITK start accepting the changes I will be an old man.

-------------
Bah weep granah weep nini bong!

Neil Walker
Member #210
April 2000
avatar

I thought you were a C# boy nowadays? And I was also under the impression that a bunch of other people were, quite beside the few I know for certain are in the iPhone Objective-C realm.

I am at work (well, depends what I'm doing - which at the minute I have no idea as I'm working drip-feed week by week, plus almost all coding is now offshored to clueless Indian students so that's ramping down as wel), but at home I do c++ (or try to) which is predominantly allegro.

If it weren't for allegro I wouldn't be using it at all, however I do see c/c++ as the syntax father of all the languages I currently use (c#, java, php) so it's best to keep up I think.

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

BAF
Member #2,981
December 2002
avatar

I'm still trying to figure out why the hell you would ever want to write "auto someFunc() -> int {}" instead of just "int someFunc() {}" - my mind fails to produce any scenario where this would even be close to useful. It seems like they introduced syntax stupidities such as this (which is even worse than ={};) just for something to do because they ran out of intelligent ideas.



Go to: