Search:
Type: Posts; User: Etherous
Search:
Search took 0.02 seconds.
-
int f(int, ... );
int f(int, ... ) {
.
.
.
}
int g() {
f(1,2,3);
-
April 25th, 2009, 10:22 PM
Okay. This makes more sense. I'd thought that the compiler was just ignoring the const. That's how the error messages were making it look. Thanks
-
April 25th, 2009, 10:03 PM
The whole problem here is that you can't do something like this:
typedef T MyType;
const MyType foo;
The compiler will simply throw the 'const' out and simply use T. That's why I was having...
-
April 25th, 2009, 09:16 PM
I want something const, so I put const in front of it. Why else would it be there? I don't care if it overwrites the constness of the type used. When someone explicitly says something, it should...
-
April 25th, 2009, 08:12 PM
Thanks. That was very informative. And yes, it seems ridiculous. Who would design a language like that? If I write const, then just maybe I'd like it to be const
-
April 25th, 2009, 07:36 PM
I just typed this up on the fly, so there's probably some errors:
int intPow(const int n, const int p) // Gets n to the power of p
{
int ret = n;
for(int i = 1; i < p; i++)
ret *= n;...
-
April 25th, 2009, 07:24 PM
Of course, any of these loops can be done using just 'if' and 'goto'. We have all these different loop structures because it makes it a little bit easier on the programmer
-
April 25th, 2009, 07:03 PM
When I use typedef to create a new type, the compiler gives me errors if I try to tag modifying keywords on. For example, if I do this:
typedef char* cstring;
void function (const cstring...
-
April 25th, 2009, 02:52 AM
-
April 24th, 2009, 01:02 AM
For example, if I were to define an axiom as follows:
axiom Associativity(Op op, T x, T y, T z)
{
op(x, op(y, z)) == op(op(x, y), z);
}
Will the compiler actually confirm that this is...
-
April 24th, 2009, 12:22 AM
Is this restricting in that this must be true for a type in order to be used in the template, or is it the developer's responsibility to make sure it's true in all cases?
-
April 23rd, 2009, 11:54 PM
So, I'm going over the C++0x draft, and I get to concepts. I'm understanding it up to where it starts getting into concept maps.
What is the purpose exactly of a concept map as opposed to a concept?...
-
April 23rd, 2009, 03:10 PM
square.h:
#ifndef SQUARE
#define SQUARE
#include "shape2d.h"
class Square : public Shape2d
{
...
};
-
April 23rd, 2009, 06:49 AM
I haven't used arrays in a while, but don't you need to use a literal or static constant for the array size in the declaration? Try doing this instead:
int *acres;
acres = new...
-
April 22nd, 2009, 01:40 PM
Just have each source file include all the other source files it requires to function, then use #ifndef to make sure it's only included once
-
April 22nd, 2009, 10:56 AM
If you make the method take const&, then it will take the temporary values
-
April 21st, 2009, 07:44 PM
Okay, thanks guys. So I should basically just look out for the usual, obvious stuff.
-
April 21st, 2009, 04:05 PM
So, I'm thinking about checking out C# Mono, and possibly incorporate it into a project I'm working on. As far as using C# as a platform independent programing language, what should I know, what are...
-
April 21st, 2009, 03:18 PM
I'd actually recommend making your own container class that not only stores the bonded atoms, but signifies type and strength of the bond, etc., but otherwise just like this
-
April 20th, 2009, 06:04 PM
-
April 20th, 2009, 06:00 PM
No, "filename.txt" in not a string; it is an array of char primitives. Above when you created a string and assigned it the filename, what is happening is behind the scenes, the string object is...
-
April 20th, 2009, 05:20 PM
Sorry. You must have posted yours before I'd posted mine saying the same thing
-
April 20th, 2009, 05:19 PM
Ah. Yes that explains a lot
-
April 20th, 2009, 05:15 PM
Might be more convenient in the long run to just do this:
typedef struct Weapon
{
...
} Weapon;
Edit: ahoodin was faster
-
April 20th, 2009, 05:14 PM
You need to convert your string object to a char array (cstring) by calling c_str() on your filename object.
|
Click Here to Expand Forum to Full Width
|