G
grahamo
Can somebody answer me this..
1)
when am I guaranteed the size in bytes of primitive types? Can I
always assume a char is one byte? can I always assume that my float is
4 bytes? likewise for longs, unsigned longs etc. What are the hard and
fast rules?
2)
also, in the following code, when an instace of derived has been
created, why exactly is the function F not ambiguous?
class base
{
public:
virtual int f(int) { };
};
class derived : public base
{
public:
derived()
{
f(0);
};
int f(char* s) { };
};
3)
is this legal? It all appears on the same line.
#define ABS(a) (a) <0 ? -(a)a) #define GTR(b) (b)>9? (1) : (0)
4)
lastly, if I have
int matrix[][2] = { {1}, {2} };
can somebody tell me exactly whats initialised to what and why the []
is legal. What exactly have I declared and initialised above?
thanks much for your help.
GrahamO
1)
when am I guaranteed the size in bytes of primitive types? Can I
always assume a char is one byte? can I always assume that my float is
4 bytes? likewise for longs, unsigned longs etc. What are the hard and
fast rules?
2)
also, in the following code, when an instace of derived has been
created, why exactly is the function F not ambiguous?
class base
{
public:
virtual int f(int) { };
};
class derived : public base
{
public:
derived()
{
f(0);
};
int f(char* s) { };
};
3)
is this legal? It all appears on the same line.
#define ABS(a) (a) <0 ? -(a)a) #define GTR(b) (b)>9? (1) : (0)
4)
lastly, if I have
int matrix[][2] = { {1}, {2} };
can somebody tell me exactly whats initialised to what and why the []
is legal. What exactly have I declared and initialised above?
thanks much for your help.
GrahamO