Type: Posts; User: Speedo
Search took 0.06 seconds.
Thanks for the replies, great info. :)
I'm used to the C++ world where there's a fairly clear distinction between dealing with an object directly and dealing with a pointer or reference... so maybe I'm overthinking things somewhat, but I...
June 25th, 2011, 10:54 PM
Apparently members have to be set up as properties before you can bind to them. I feel dumb now.
June 25th, 2011, 08:12 PM
Can anyone give me an example of how to set this up when the StringCollection is a class member? I've been able to get it to work with a StringCollection that's in project settings, but can quite...
Preferably something aimed towards a more experienced programmer (have about 8 years now of C++ experience, and various other languages). I've tinkered with C# from time to time and it isn't that...
April 24th, 2011, 05:49 PM
What you have there isn't really a singleton... it's something more like a factory. Only one A exists within the createA() function (thanks to it being static), but you have more than one A in your...
April 3rd, 2011, 10:16 PM
"Continue" causes the rest of the loop to be skipped. So when it's triggered, execution just goes back to the start of the loop, meaning you never advance to the next character in the string.
March 28th, 2011, 09:55 PM
You pass the size. Or you encapsulate the array in an object that holds the size for you, like std::vector or std::tr1::array.
If you want to play with things like this, none of us can stop you,...
March 27th, 2011, 11:18 PM
I'd say it's because with just "arr", automatic type conversion has the array decay into a pointer to its first value, with the type int*. The declaration "int (* ptr)" specifically needs a...
March 5th, 2011, 01:35 PM
Because people tend to prefer looking at "A = B + C;" instead of "A = Add(B, C);".
Operator overloads are syntactic sugar - they make code look neater/prettier. That's all.
Edit: It may not...
March 5th, 2011, 11:55 AM
Sure it's possible. But why would you want to? The concept of c-style strings revolves around them being null-terminated. The only time I can think of when you might even think about doing it is...
March 4th, 2011, 11:44 PM
"abc" is 4 characters. 'a', 'b', 'c', '\0'.
February 15th, 2011, 07:56 AM
A lot of people in this thread seem to be forgetting the current job climate. Can you be a very good programmer without a degree? Of course. Are you likely to get a programming job at the moment...
February 1st, 2011, 06:06 PM
In performance? I don't really see how it would. Member ordering can affect the object's size though, depending on compiler settings and so on (probably no difference for a simple case like that...
January 11th, 2011, 08:55 AM
Should only be a problem if you use a ctor/dtor, operator overloading, virtual functions, etc. All of which can be used with either struct or class.
August 7th, 2010, 09:47 AM
It looks like the errors stem from missing includes in phonebook.h. The compiler reads and processes each file from top to bottom, so you need to include the appropriate headers for std::string and...
August 6th, 2010, 06:26 AM
I'd really just save yourself the trouble and instead have the user define macros indicating that those features should be used.
August 3rd, 2010, 11:19 PM
I'm pretty sure C89 supports const. The Comeau online compiler in strict C89/90 mode doesn't complain about it.
As far as version, there's the macro __STDC_VERSION__, defined as 199901L for C99. ...
July 31st, 2010, 03:25 PM
Check the stream for failure. See
July 31st, 2010, 10:14 AM
You don't. The vector allocated the memory and the vector is responsible for cleanup. If you need to remove individual items you can do so using pop_back(). Otherwise you don't need to worry about...
July 31st, 2010, 08:09 AM
You only need to delete what you create with new.
July 30th, 2010, 09:19 AM
Sometimes. You often do with games, for example, because performance can be unusably bad on the debug builds.
July 29th, 2010, 03:20 PM
I didn't read the code in detail, but yes that looks more like what we're talking about.
One thing though, on switch statements you can stack multiple options like so:
July 29th, 2010, 09:24 AM
*cResult.getTotalSum() will attempt to dereference the value returned by getTotalSum rather than the pointer cResult. Use (*cResult).getTotalSum() or, preferably, cResult->getTotalSum().
July 28th, 2010, 05:03 PM
I believe you need to #include <memory> in order to use placement new.
Also, placement new should take a void*, not an A*.
That said, I agree with Lindley.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.