VC++ 2010

Pages: 12
Apr 14, 2010 at 1:52pm
Anyone tried it, yet? Uncharacteristically for Microsoft, they've broken a few common expressions involving pointers. I was trying compiling some old code yesterday (that of course I had previously compiled with both VC++ 9.0 and GCC) and got an error on this line:
1
2
3
//std::vector<T *> buffer;
//size_t a;
buffer.insert(buffer.begin()+a+1,0); //error C2440: 'initializing' : cannot convert from 'int' to 'T *' 
Maybe it's just me, but I really don't think I need the explicit cast, there. Or nullptr, for that matter.

Oddly enough, push_back() works as expected.
Apr 14, 2010 at 2:11pm
did you try it with NULL or ((void*)0) ?...

didn´t test the NULL-pointer till now... gonna do it, later and report back to you...
Apr 14, 2010 at 2:15pm
NULL expands to 0. Implicitly casting 'void *' to non-'void *' is illegal, so that wouldn't compile even on 9.0.
Apr 14, 2010 at 2:28pm
we are both talking about the second parameter, arent we? (to make sure i understood you correctly)...
Apr 14, 2010 at 2:29pm
Yes.
Apr 14, 2010 at 2:32pm
I thought NULL expanded to ((void*)0), or is that just C?
Apr 14, 2010 at 2:37pm
Yes.

1
2
3
4
5
6
7
8
//stddef.h (27):
#ifndef NULL
#ifdef __cplusplus
#define NULL    0
#else
#define NULL    ((void *)0)
#endif
#endif 
Last edited on Apr 14, 2010 at 2:38pm
Apr 14, 2010 at 2:45pm
did you try the nullptr, too?...
Apr 14, 2010 at 2:51pm
Try an explicit cast?
Apr 14, 2010 at 3:10pm
chrisname wrote:
Try an explicit cast?


helios wrote:
but I really don't think I need the explicit cast there.


But that's...odd. I think they did break it...guess I'm not going to upgrade then. >_>
Apr 14, 2010 at 4:12pm
http://msdn.microsoft.com/en-us/library/sy5tsf8z%28VS.100%29.aspx
C2440 can occur as the result of conformance and update work that was done in the Standard C++ Library.
Apparently it's not accidental. I still think it's odd that the explicit cast is required.
Oh, well. It's not like it costs anything.
Apr 14, 2010 at 4:13pm
<richard stallman>
Except your freedom!
</richard stallman>
Apr 14, 2010 at 7:52pm
<Bill Gates>
Accept your freedom!
</Bill Gates>
Apr 14, 2010 at 8:19pm
<Steve Jobs>
Master of brainwashing people into thinking buying a computer is joining a social movement, away!
</Steve Jobs>
Apr 14, 2010 at 8:43pm
If you're not using any clr / managed stuff : why would you ever on earth prefer compiling with VC++ instead of mingw (gcc) ?
Last edited on Apr 14, 2010 at 8:43pm
Apr 14, 2010 at 8:47pm
closed account (z05DSL3A)
<Ada Lovelace>
Call that an algorithm? This is an algorithm!
</Ada Lovelace>
Apr 14, 2010 at 9:20pm
If you're not using any clr / managed stuff : why would you ever on earth prefer compiling with VC++ instead of mingw (gcc) ?
At the compiler level, there's indeed very little difference. The debugger, however, is superior to anything GNU has to offer. To put it bluntly, gdb sucks balls.
Older versions of MinGW used to have conformance problems even bigger than the one I mentioned above and several bugs. Having to explicitly cast a zero is nothing compared to swprintf() taking the wrong number of parameters, or the compiler producing wrong code under specific circumstances or sometimes even crashing non-deterministically (both have happened to me with MinGW 3.x). At least with VC++ I have a little more certainty that if the input is correct the output will be correct.
Apr 14, 2010 at 10:35pm
im still interested wether it work when you use vec.insert(vec.begin()*x+1, nullptr); ???
Apr 15, 2010 at 3:13am
I did say it worked on my first post. That's not really relevant, though, because I'm working with C++98.
Apr 15, 2010 at 2:01pm
Does anyone else have this issue where a new project/solution won't "start without debugging"? I usually do that so the console window stays open, but when I click "start without debugging," it just goes through as if it's only debugging and closes the window down.

I know there are a number of workarounds, but I am curious as to why the start without debugging won't work. Anyone else have this issue?
Pages: 12