Type: Posts; User: Gorgor
Search took 0.01 seconds.
September 7th, 2010, 02:49 PM
I just had this with the latest and greatest of gcc and minwin and Eclipse (IDE) when compiling a simple win32 "Hello" program that pops up a window with a button.
Here are the hoops I had to jump...
Is the following valid?
const char* someFunction( void )
return "some string";
Which, of course, brings us full circle to my subordinate question: The pointer returned IS actually altered.
In the case of multiple inheritence, where B is an A and a C at the same time, the...
So reinterpret_cast is just a syntax appeaser, telling the compiler to think of this pointer as a pointer to x rather than a pointer to y.
But how would that ever differ from static_cast if both...
April 19th, 2004, 03:55 PM
I was sure I had read somewhere that casting such objects to other objects in their heirarchy could change the actual pointer value.
If that is not the case, then how does static_cast differ from...
April 16th, 2004, 08:52 AM
I, of course, made a mistake in my posting. The array I meant to be an array of pointers to base, not of the base class itself.
Having said that, and having read...
April 15th, 2004, 04:35 PM
And as a follow up, as a practical matter, if you don't use multiple inheritence, will the results of reinterpret_cast and static/dynamic_cast ever differ on various compilers? I.e. will the base...
April 15th, 2004, 04:33 PM
Let's suppose I have an array of a base class, but it's filled with derived classes. I'll use only one derived class, but suppose there are several types.
Edit: wrong! CBase...
March 5th, 2004, 12:54 PM
> In C++, a string has a special meaning -- a std::string.
Are you sure? I've been programming in C++ for 10 years now, and when a programmer says "string", they still always mean an array of...
March 5th, 2004, 12:35 PM
Why even use a float or double to begin with? Fixed-level math can better be done with integers, and then only needs to be converted to decimal in the output.
int amountInCents = 12991;
March 2nd, 2004, 10:02 AM
Here's your simple pseudocode:
if (myPoly1.numTerms != myPoly2.numTerms)
March 2nd, 2004, 09:47 AM
while (c=getchar() != EOF) putchar(c);
/* Surprisingly, it doesn't produce zeros while I type; rather it produces some wierd characters that look
half like zeros and half like smileys. And...
February 24th, 2004, 01:25 PM
I worked on a system for the Coast Guard once that parsed hand-typed messages that had to locate many different fields.
We used a "blackboard system", which is basically a 2-phase parsing. The...
February 19th, 2004, 01:51 PM
In this trivial case, where only member variables are set, then yes, the initializer list is fine. For non-trivial cases where other work is done, say calculations or initializations of more complex...
February 19th, 2004, 01:48 PM
Four years ago I played Java versions of Space Invaders and Asteroids, and they looked better, and played just as well as, anything in an arcade 20 years ago.
Go for Java and then you can dump it...
February 19th, 2004, 01:28 PM
> I have hesitated asking for fear of embarassment but... the
> only stupid question is the one you know the answer to.
And even then, sometimes it must be asked.
E.g. "Sandra Bullock, Nicole...
February 19th, 2004, 01:25 PM
I suppose the professor was teaching the use of a stack to reverse things, but I don't know how much "deep understanding" will be gained by it. Plus it is an extremely klunky looking implementation....
February 19th, 2004, 01:17 PM
%d in scanf tells it to look for a decimal number in the input, not a hexadecimal number.
If trying to read "C8", the scanf would first see the "C", and choke because that isn't a digit, which it...
February 19th, 2004, 01:12 PM
If you're printing out a 32-bit hex number, do this:
For 003abcde, will print:
February 16th, 2004, 12:40 PM
I haven't done any 64 bit programming, yet. Do int64's have to be 8-byte aligned, the way 32 bit ints have to be 4-byte aligned?
If so, that might be another cause of the problem. &some32BitVar...
February 16th, 2004, 12:19 PM
It seems to be half Ivory Tower talking, cut off from the real world, and half '60's assembly programmer leftover talking about their old problems.
In some languages, like pre-Visual Basic (no...
February 12th, 2004, 12:23 PM
Unfortunately making a function call is not viable. This is a very large project, and that is in a part of code shared with other project. Literally, not figuratively, hundreds of files would be...
February 11th, 2004, 09:57 AM
They're gettin' a lil' needlessly complex here.
Assuming numWords is > 1:
int firstNounIndex = rand() % numWords;
int secondNounIndex = 0;
while ((secondNounIndex = rand() % numWords)...
February 11th, 2004, 08:44 AM
Ok, so I have a class that overrides the (const char *) operator. This override returns a C string that is not the same as the pointer to the class.
Which, if any, of these calls will invoke...
December 5th, 2003, 04:04 PM
I understand how it works.
I know how to pause and sleep and things.
I was asking if anyone knew how to tell Visual Studio to not close it. Versions prior to 6 (4 at least) have a specific...
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.