Search:
Type: Posts; User: James Curran
Search:
Search took 0.61 seconds.
-
March 13th, 2002, 02:34 PM
{quote]A compiler may optimise by replacing:[/quote]
That's not an optimization, and the compler has no option. It is a standard alternate syntax. The two forms you cite are the same on all...
-
February 4th, 2002, 04:05 PM
#define const elems 12
This defines a macro named "const" which is equal to "elems 12". I doubt this is what you want. More likely
#define elems 12 // "elems" = 12
// or, better
const int...
-
February 4th, 2002, 03:54 PM
everywhere you have "char corres[...]", it should be "char* corres[..]".
int startScan, minIndex, minValue, minimum;
should be
int startScan, minIndex;
float minValue, minimum;
-
February 1st, 2002, 08:39 AM
The only possible way:
class Base {...};
class DerivedA : public Base {....};
class DerivedB : public Base {....};
// etc....
Base* GetADerived( /* whatever you use to indicate the object */)...
-
January 22nd, 2002, 10:58 AM
Namespaces are a way to separate things from different sources. Say you wanted to you two different third-party libraries for your project: Freddy's Functions for the sockets, and Walter's Widgets...
-
January 22nd, 2002, 10:58 AM
Namespaces are a way to separate things from different sources. Say you wanted to you two different third-party libraries for your project: Freddy's Functions for the sockets, and Walter's Widgets...
-
January 22nd, 2002, 10:44 AM
Of course it won't. If A contains a B, how could a B possibly contain an A? Try an experiement at home with a big box labeled "A" and a little box labeled "B" if you still have trouble grasping...
-
December 24th, 2001, 10:58 AM
The scanf()s must account for the newline scanf("%d\n", &num);
Truth,
James
http://www.NJTheater.com
http://www.NovelTheory.com
I don't do it for the points (OK, maybe I do), but rating a...
-
December 24th, 2001, 10:56 AM
The Boost library (http://www.boost.org) has a regular expression class which handles POSIX expressions. (It also has a very good chance of becoming part of the next C++ standard, so you might want...
-
December 23rd, 2001, 05:18 PM
And they already don't translate [ ccode ] tags which aren't acconpanied by [ /ccode ]s, so You'd think not translating [ i ] without [ /i ]s would be a snap.
Truth,
James...
-
December 23rd, 2001, 07:46 AM
If his code, he frequently used "[ i ]" (without the spaces), to index off of input and buff. These cause the code to change to italics on this forum, instead of being displayed.
The last 4 of...
-
December 23rd, 2001, 07:36 AM
The last number is printed as negiative because enums are inherently based on signed ints. It should print the correct value by changing the code to:out << endl << (unsigned) my_code8 << endl;
...
-
December 23rd, 2001, 07:17 AM
The "v-table" is the standard method of implementing virtual function in C++ (There's not requirement that it's done using one, but I know of no compile that does it differently)
TO understand...
-
December 23rd, 2001, 06:54 AM
According to the Standard, vector is defined in namespace std.
However, while compiling a program, the compile does not know about that. It only knows the declarations that it sees. Therefore,...
-
December 20th, 2001, 12:50 PM
You can try the date class I (and a bunch of other people) wrote some time ago.
http://www.noveltheory.com/download/killerc.htm
Truth,
James
http://www.NJTheater.com...
-
December 20th, 2001, 12:48 PM
(a) mainly, through trial and error.
(b) You have to understand how CPU stacks work.
void func()
{ char buff[4];
/// ... whatever
}
By the time execution reaches the "whatever" bit,...
-
December 20th, 2001, 12:37 PM
First of all, what you ask is impossible (If a garage (class A) contains a car (class B), how can the car *also* contain a garage?)
Otherwise, what Igor said is correct (although, it's not...
-
December 20th, 2001, 12:34 PM
Shift operators are not the right plan here....Try bitfields:union A
{
struct B
{
short dummy1:1;
short data:12;
short dummy2:3;
} bits;
char byte[2];...
-
December 20th, 2001, 12:26 PM
Funny, It works for me. (Note, you MUST put it before any #include)
Truth,
James
http://www.NJTheater.com
http://www.NovelTheory.com
I don't do it for the points (OK, maybe I do), but rating...
-
December 19th, 2001, 04:32 PM
Because you are trying to write a oper+ for two native types (char*s). You can no more do that, than you could redefine what operator+(int, int) means.
Truth,
James
http://www.NJTheater.com...
-
December 19th, 2001, 02:31 PM
No. At least one of the two operands must be a non-native type (ie, a class).
String operator+(String, char*); is OK.
String operator+(char*, String); is OK.
String operator+(String, String);...
-
December 19th, 2001, 01:35 PM
Of course, you can combine strings. Heck, *strings* already have an oper+ defined.
You just can't combine char*s.
Truth,
James
http://www.NJTheater.com
http://www.NovelTheory.com
I...
-
December 19th, 2001, 10:09 AM
You can't fix it, you can merely hide it.
To hid it, put the line#pragma warning (disable:4786)
before any include file.
NOTE: Anything placed before #include <stdafx.h> is ignored, so...
-
December 19th, 2001, 10:06 AM
err..no. Yours only appears simpler because you left out parts. Your linememcpy( buf, &fPi, sizeof( float ) );
merely replaces my lineb.asFloat = data;
Mine does it as a simple assignment...
-
December 19th, 2001, 12:08 AM
You cannot add two char*s. The only way to fix your example is to make one of them something else (spec. a class).
Truth,
James
http://www.NJTheater.com
http://www.NovelTheory.com
I don't do...
|
Click Here to Expand Forum to Full Width
|