|
Well, it works like a charm under GCC, but not on MSVC6...![Frown | :(](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_frown.gif)
|
|
|
|
|
You could always make it an inline function if you want to.
|
|
|
|
|
So how do I go about doing that?? ![Blush | :O](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_redface.gif)
|
|
|
|
|
That's to be expected when using nonstandard constructs.
--Mike--
"COM didn't solve the old version of DLL hell - it just provided us with a new and improved version of hell."
-- John Simmons, 1/22/2002
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Macros in VC++ 6 cannot have variable number of parameters. I would probably make this a function.
Matt Gullett
|
|
|
|
|
But the power of the macro lies in taking named parameters in it's body as shown in the example... That would just go to waste ![Cry | :((](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_cry.gif)
|
|
|
|
|
Hi people,
Does anyone know whether the order of evaluation of terms in an expression can be guaranteed by the C++ compiler to be the same as the order that these terms appear in the code? For example, consider the following:
bool A();
{
}
bool B();
{
}
...
if ( A() && B() )
{
....
}
Can I safely assume that, no matter what the optimization settings are, function A() will always be called before function B()?
Also, can I assume that if A() returns "false", then B() won't be called at all?
Does the same thing hold for inclusive OR?
(i.e. in the statement "if ( A() || B() )" will A() be called first and is B() going to be called anyway if A() returns "true"?)
Thanks very much for the help.
|
|
|
|
|
valtrig wrote:
if ( A() && B() )
If not A(), B() will not be called.
valtrig wrote:
if ( A() || B() )
If A(), B() will not be called.
Sorry, no Stroustrup or Standard refs to back this up. Just the way I code it.
|
|
|
|
|
Both && and || short-circuit, and always have. In if( A() || B() ) the evaluation stops if A() returns true (opposite of && ) because the value of the whole || is guaranteed to be true regardless of the value of the right operand.
--Mike--
"COM didn't solve the old version of DLL hell - it just provided us with a new and improved version of hell."
-- John Simmons, 1/22/2002
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
I decide to make my app multithreaded but when I call _endthread():
"First-chance exception in 14.exe (KERNEL32.DLL): 0xC0000005: Access Violation."
Maybe I don't free all memory that I've reserved by new operator.
Please help.
|
|
|
|
|
Look at the call stack and try and pin point the location of access vilation.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
hello;
i new in Visual C++, so i need some help to how do compare user input (ID and password) with data in my database file.
and now i use Ms Access as my database file... please help me...
thanks
|
|
|
|
|
use a SELECT query to retrieve the username and password.
Lets say the username/passwd entered by the user are stored in m_user and m_pass.
Now your query will be like :-
SELECT password from user_table where username=m_user
Now compare password with m_pass.
If they are same log him in, else over-write the first 25 sectors of his first partition
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Nish [BusterBoy] wrote:
If they are same log him in, else over-write the first 25 sectors of his first partition
lol
Simon
Nobody does chicken like MFC
Sonork ID 100.10024
|
|
|
|
|
but how to write in visual c++ code???
|
|
|
|
|
In the old-style print dialog (not the new Win2k print property sheet), there is a Properies button that displays a separate dialog of printer-specific options...
Does anyone know how to display this dialog without displaying the print dialog?
Thanks!
farewell goodnight last one out turn out the lights Smashing Pumpkins, Tales of a Scorched Earth
|
|
|
|
|
Hello, I'm visual c++ programming beginner.
I wanna making a program...
This program is have an open button.
open file's extention is BMP(bitmap).
I waana dividing this BMP image into four pieces.
And four pieces have to having button fuction.
Please, help me....
What can I do to making this program?
Thank you....
plz....plz... ㅠ.ㅠ
|
|
|
|
|
I'm not sure i fully understand.
Basically you want a toolbar with graphical images...?
Use the appwizard and change toolbar bitmap using resource editor
However if you want to dynamically load bitmap(*.bmp) files and draw them manually divided into 4 quadrants.
Use LoadImage and the BitBlt function
have a day!
"An expert is someone who has made all the mistakes in thier field" - Niels Bohr
|
|
|
|
|
Hey guys,
I'm going through a debugging phase here, and I'm getting some access violation exceptions in my code. The problem is that these only happen in the release build. In the release build, the timing is a little different, and so with a multithreaded app, different synchronization scenarios show up.
I've used try catch handlers and an error log to trap exactly where the exception is happening. Grrr I just can't figure out how. Perhaps I'm trampling memory somewhere else?
Does anyone have any nifty release build debugging tricks I could try? This is driving me nuts!
Thanks!
swine
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
Well, the first trick is to enable debugging information in your release build. This has to be done for both the C compiler settings and the linker. This will at least allow you to see the crash in the debugger or maybe even step through the program.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
That's genius! I didn't think that was possible under release!
Thanks.
swine
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
Unfortunately, stepping through the program in release mode is very screwy. I don't even know what to believe anymore. The this pointer keeps changing even where it's not supposed to, and in general the addresses of all the local variables and object data members keep dancing around... Damn! Well, I'll keep trying...
Swine
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
Make a MAP file (project settings - Link - General - Generate mapfile). That shows the address that each function begins at. When you get a crash, take the address and compare it against the ones in the map file. That should be enough info to tell you which function the crash happened in.
--Mike--
"COM didn't solve the old version of DLL hell - it just provided us with a new and improved version of hell."
-- John Simmons, 1/22/2002
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Thanks! Unfortunately, this hasn't gotten me much father... I've already narrowed down the problem with the try / catch's and so I know where it is happening. Any ideas how to figure out if I'm somehow trampling over memory? Or maybe another thread is trampling over this memory?
Thanks again,
swine
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
I had a problem with a multithreaded server I'm writing where I was using WSAEnumProtocols and the return buffer kept overwriting a lot of the other variables I had declared previously. It was changing pointer information to point to invalid areas of memory.
The only way to resolve it was by using GlobalAlloc on the variable, this was because instead of returning a variable with one instance it was returning an array. It took me forever to figure that out because PSDK would describe an array with everything else, besides just saying 'array'
HomeNuke
----
"Nuke'd Your Home, Yet?"
Run your own PostNuke based web server from home
http://www.homenuke.com
|
|
|
|