|
PJ Arends wrote: "Treat wchar_t as built-in type"
What exactly does that option do? Will the compiler generate different code? Will L"strings" stop working?
|
|
|
|
|
From what I get from the link I provided, if wchar_t is treated as a built in type then it is treated the same as a char, short, long etc. When I turn the option off then wchar_t is simply a typedef for an unsigned short.
I think the advantage is when doing type checks with wchar_t as a built in type the complier can tell the difference between wchar_ts and unsigned shorts, otherwise it can not tell the difference. Everything else should work the same AFAIK.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Jörgen Sigvardsson wrote: What exactly does that option do? Will the compiler generate different code? Will L"strings" stop working?
No. If you enable that option, literal unicode strings are given the type wchar_t . This type is considered a distinct type by the compiler (not a typedef'd unsigned short ). The advantage is it is more typesafe, and you don't have to do a typedef yourself. The disadvantage is you have to look for type conflicts in existing code - it's an option you'd want to enable at the beginning of a project.
You can freely typecast between wchar_t and unsigned short , although I'm not sure whether the compiler will do it implicitly.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
hi
i am programming with vc++ 2005 ,i use an acces database with ODBC.i can add data to the database ,but my problem is to read from my database .
is there any idea that can help me ?
|
|
|
|
|
More details about your problem please --- what you HAVE DONE for reading the data from the tables in the database.
Maxwell Chen
|
|
|
|
|
I'm running VC++ Express .Net 2005, and i'm trying to compile an application with the native subsystem. I am getting a linker error reading "Unresolved external symbol _NtProcessStartup. I have tried preprocessor definitions and defining it as a function, but nothing has worked. The symbol isn't in any library. Can anyone help? (This is actually from the General Discussion board, but someone advised me to put it here.)
__________________________________________
Let's push Satan
|
|
|
|
|
EntryPoint[^].
You have to check your linker options, as:
/SUBSYSTEM:NATIVE /DRIVER:WDM –entry:NtProcessStartup
Maxwell Chen
|
|
|
|
|
Hi,
How would i get the current windows directory while in kernel mode?
Kernel mode means Win32 APIs dont work so i cant use GetWindowsDirectory
|
|
|
|
|
If you're accessing a file, you could use the environment variable "%WINDIR%".
__________________________________________
Let's push Satan
|
|
|
|
|
Anybody know how to get internet connection speed ??
Thank you for your time!
Servia Nostrum Regnum
-- modified at 20:52 Saturday 15th April, 2006
|
|
|
|
|
Anythig about internet connection speed,some link,hint,anything ???
Thx!
Servia Nostrum Regnum
|
|
|
|
|
how to define inline function in class complied under VC++ win console app?
"test.h"
class test
{
...
inline void func(void);
}
"test.cpp"
inline void test::func(void)
{
...
}
produces LNK2019 error
and whats the project settings for inline function expansion?
9ine
|
|
|
|
|
9ine wrote: "test.h"
class test
{
...
/* inline */ void func(void);
}
"test.cpp"
inline void test::func(void)
{
...
}
Maxwell Chen
|
|
|
|
|
this gets LNK2001: unresolved external
9ine
|
|
|
|
|
Try this[^].
Maxwell Chen
|
|
|
|
|
|
Your code must be in the header file. You can either put it after the class definition and use the keyword inline or put the code inside the class definition right where you declare the method. In both cases, don't use the inline keyword inside the class definition.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Well its a wierd to put function defenition into the header file, the only situation for this when you have templates
In Borland Builder we can keep inline function defenition in cpp files.
Can we keep somehow in VC++ inline functions declared in cpp file?
but anyway it is now compiled
"test.h"
class test
{
...
inline void function();
}
inline void test::function()
{
...
...
}
9ine
|
|
|
|
|
You can put inline function definitions in the .cpp file, but the compiler will never inline them. If you want the compiler to inline them, they must be in the header file. I'd be surprised if Borland does this differently.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I dont know if Borland really makes them inline but it doesnt produce error link messages when inline function is in cpp file compared to VC++
9ine
|
|
|
|
|
I once tested with VC++ 6.0 many years ago. The EXE size of inlined build was fatter than non-inlined.
[Edited] Worth to mention by the way, well-designing the code is much more important than the inlining toy regarding to the performance. [/Edited]
Maxwell Chen
-- modified at 13:53 Sunday 16th April, 2006
|
|
|
|
|
code size does not depend I presume on the inline or not. Executable size comes in quanta as in quantum physics, and it does not compile it larger until some amount of code is added, that is some reservation of space and if the code exceeds it then there comes increase in exe file and another reservation. it is just happenstance to get it grow larger introducing inline funcs.
9ine
|
|
|
|
|
9ine wrote: code size does not depend I presume on the inline or not. Executable size comes in quanta as in quantum physics, and it does not compile it larger until some amount of code is added, that is some reservation of space and if the code exceeds it then there comes increase in exe file and another reservation. it is just happenstance to get it grow larger introducing inline funcs.
This is the general case when we are developing our code.
In the beginnig, the output exe is 16KB.
We add some code, and it keeps in 16KB for a while.
And suddenly it becomes 20KB ... and then 24KB ...
- - -
But what I pointed out was:
- You implement some inline global or member functions, and have them heavily invoked everywhere in the code. In other words, you just mean to concentrate in playing inline topic.
And don't just implement such kind of code as:
int MyClass::GetNumber() {<br />
return _iNum;<br />
}
but do something more overhead as:
int MyClass::GetNumber() {<br />
BYTE data[5] = {0};<br />
data[1] = 1;<br />
data[2] = data[1] * 3 + 4;<br />
data[3] = data[4] & ~data[2];<br />
data[5] = (BYTE)_time(NULL);<br />
}
1) Turn OFF the inline switch in the compiler option, comment out the inline keyword, and compile it.
2) Turn ON the inline switch in the compiler option, put the inline keyword back, and compile it.
The term code bloat is seen in each articles and books talking about inline functions.
For example: [9.3] Do inline funcitons improve performance?[^]
Maxwell Chen
|
|
|
|
|
Dear gurus,
I have a question concerning collisions between rectangles.
I have to test if 2 sprites collide together in standard C without Win32 API
I have built the following structures:
<br />
typedef struct _SPRITEDESC <br />
{ <br />
POINT location; <br />
DIRECTION direction; <br />
SIZE size; <br />
unsigned short* table; <br />
unsigned short* masks; <br />
} SPRITEDESC, *PSPRITEDESC; <br />
<br />
typedef struct _POINT <br />
{ <br />
int x, y; <br />
} POINT, *PPOINT; <br />
<br />
typedef struct _SIZE <br />
{ <br />
int cx, cy; <br />
} SIZE, *PSIZE; <br />
<br />
typedef enum _DIRECTION <br />
{ <br />
DIRECTION_NONE, <br />
DIRECTION_UP, <br />
DIRECTION_DOWN, <br />
DIRECTION_LEFT, <br />
DIRECTION_RIGHT, <br />
} DIRECTION<br />
and I need to write a function with a similar header:
bool SpriteCollide(SPRITEDESC s1, SPRITEDESC s2); <br />
that tells if the two sprites enter in collision or not.
How can I proceed?
Can someone help me please?
Best regards.
Fred.
There is no spoon.
|
|
|
|
|