Thanks
TheIdeasMan. Now I really understand why the float comparison sometimes fails.
I typed a test code, like this :
1 2 3 4 5
|
strcpy(string_test,"\
float fvalue = 23,\
printf(\"Current value : %f\nPlease enter a value (float) : \", fvalue),\
scanf(\"%f\",&fvalue), 45 ,\
printf(\"The value : %f\n\",fvalue)");
| |
And tested it with
678.54.
Finally the program gives
678.539978, the value certainly is not equivalent to initial value
678.54 (
678.539978 == 678.54 always returns false)
Even I set a
double value instead of
float but also it doesn't work...
devonrevenge wrote: |
---|
hey will i be able to understand this child language? can i test it? |
Sure you can. Be patient.... :)
L B wrote: |
---|
Declare in header.hpp
Define in source.cpp
|
Oh, that's great! I googled it and finally I've solved the crazy problem. Oh that makes me very overjoyed!!!
Now my project looks like :
Static library
Source files
Expression.cpp
Function.cpp
Definition.cpp
Test.cpp
Main.cpp
Header files
Definition.h
Function_list.h
Macros.h
EssGeEich
Lol... :D
Oh, do you know? Over 90 % of functions total I used inline!!!! :D
EssGeEich wrote: |
---|
Useless, does it change anything from debug to release compilation? I guess not, except for an eventual 'debug' keyword on the title's name.
|
Before that I said the current project I am working on is a general version. So it's completely unrelated to
compilation. What do you mean by
"general"? :)
Woohoo!!!! Hooray!!! It's almost done!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Did you take a look at the first example? Wow, I've just successfully called the function
scanf. What's new? I picked "
scanf " because it requires
reference access. To call this kind of function properly, you have to cast all objects to pointers. Then, here's the syntax :
Symbol : & - Before any variable
r-value : illegal - will be ignored
int value, scanf("%d",&value), printf("Value : %d\n",value)
How to push values?, At beginning, I ever typed some crazy code like this :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
struct function_parameter
{
union{
int *lpint;
short *lpshort;
short *lpwstring;
char *lpchar;
char *lpstring;
bool *lpbool;
long long int *lplong;
float *lpfloat;
double *lpdouble;
int nValue;
float fValue;
double dValue;
char cValue;
bool bValue;
long long int lValue;
};
enum variable_type type;
unsigned int reference_level;
unsigned int pointer_level;
};
| |
OMG that...that's very horrible!!!!.
That's about sixteen cases total!!!
Oh, looks like *void now is really useful. That's another help,
hamsterman!!
...yes, any address can be assigned to a void*. |
Basically each pointer value always holds 4 bytes stack (My OS certainly is 32-bit) :)
Simply with any pointer, I'll only need to :
1 2
|
__asm push lppointer;
nBytes+=4;
| |
With the powerful definition
*void, I can cast any regular value with :
1 2 3 4 5 6 7 8 9 10 11
|
void *lpvoid;
int a;
float b;
double c;
POINT d;
lpvoid = &a; //Ok
lpvoid = &b; //Ok
lpvoid = &c; //Ok
lpvoid = &d; //Ok
| |
And push them without causing any problem. :)
Done, level 1. Now I'm going to build up auto type variable now...
Ha Ha Ha Ha...