|
Vikram Punathambekar wrote:
It's smart, but how will you remember that two weeks from now. If the workaround is difficult, use this by all means, but COMMENT IT!
Well, it's written, or at least a big part of it is.
The whole reason I headed down this path was to make sure that the classes were exception safe. I've been looking into the Herb Sutter's material (Exceptional C++), and this way seems to be the only way to make any kind of exception safety guarantee. I never realised how much extra work it was going to be, nor the compromises that would have to be made.
Doing proper exception handling is so hard
Thanks for the feedback though
|
|
|
|
|
hey people
have taken your advice, but it just won't work, keeps coming up with the error in the subject line. any help would be truly appreciated..
here's what the code looks like:
#include "stdlib.h"
int* CreateArrayOfRandomNumbers(int nSize)
{
int* pArray = new int[nSize];
if( NULL == pArray );
return NULL; // memory allocation error
for( int i=0; i);
{
pArray[i] = rand();
}
return pArray;
}
|
|
|
|
|
your "if" and "for" statements don't need a semicolon at the end.
in this particular case, it shouldn't cause the error you re getting but you never know try fixing that first.
Software is everything. It also sucks. Charles Fishman [^]
Awasu 1.0.3 (beta)[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
thanks i'll try that..
|
|
|
|
|
Taka Muraoka wrote:
"if" and "for" statements don't need a semicolon at the end
Seriously, be more specific- you shoulda prolly said "shouldn't have a semicolon". OK, OK, you can have empty for loops, but empty if blocks IMO should never be used.
Vikram.
-----------------------------
1. Don't ask unnecessary questions. You know what I mean?
2. Avoid redundancy at all costs.
3. Avoid redundancy at all costs.
"Do not give redundant error messages again and again." - A classmate of mine, while giving a class talk on error detection in compiler design.
|
|
|
|
|
I presume you've just included a snippit of the whole file there. This error is often caused by mismatched braces further up the file where you have one more open brace than you have close braces.
For example :
void MyFunction1()
{
void MyFunction2()
{
}
|
|
|
|
|
Remove the semicolon at the end of this statement:
if( NULL == pArray );
There is a misplaced semicolon in this statement (or you got bite by HTML formatting):
for( int i=0; i);
int *CreateArrayOfRandomNumbers(int nSize)
{
int *pArray = new int[nSize];
if( NULL == pArray )
return NULL;
for (int i = 0; i < nSize; i++)
pArray[i] = rand();
return pArray;
}
|
|
|
|
|
|
Anyone heard bout 'Scene Structure' ?
How to construct Scene Structure from a bitmap ?
If possible please provide me the algorithm or source code, thank you.
|
|
|
|
|
#include <fstream.h>
ifstream in("test.oop");
Is causing problems...how do I fix this...?
i'm getting an 'ifstream' : ambiguous symbol error???
Thanks in advance
"Two wrongs don't make a right, but three lefts do!" - Alex Barylski
|
|
|
|
|
Add using std::fstream.
Kuphryn
|
|
|
|
|
Hi guys,
I'm implementing zmodem class which is downloaded from another site, programmer's heaven. I'm implementing that class in VB for my project work.
I'm not expert in VC++, but I'm able to convert the VC++ DLL into VC++ OCX and using that OCX in VB project. I made OCX cox, I need to use the same in PowerBuilder too.
I exposed 3 methods InitCOMM(), SendFiles(), ReceiveFiles() to use in VB.
The handle in VC++ classes for writing and reading COM port is defined as void *, and exposed them as long int.
I established the connection between 2 computers using MSCOMM control in VB, and passed the MsComm1.COMMID to the InitCOMM() method to initialize the zmodem class. Now, it gives automation error when I use Send/Receive functions, .. the vc++ WriteFile() always fails to write to COM port in I/O overlapped mode.
Can any one help me, how to get rid of this or any other solution for ZModem implementation.
thanks in advance
=========================
http://www.weilersplace.de/dl/zmodemclass.zip
===========================
Nathani,
Sr. Programmer
|
|
|
|
|
in my app, i need open files very fast.
the function CreateFile() is very slow, i.e. for a file of 10K bytes, the function needs around 10-50 ms (related to PC) to open it.
do u have idea to open files faster?
thx
includeh10
|
|
|
|
|
Well on Win32, CreateFile is about as low level as you are going to get. The speed of the open operation should not be dependant upon the size of the file, but the speed of reading the file will surely be dependant upon the file size. If you are really talking about the speed of reading files, I would suggest looking into memory mapped files. They are very very fast to read. Take a look at MapViewOfFile in the MSDN.
If you really are only concerned with the speed of the CreateFile (and not reading the file), then sorry I cannot be of any help.
Chris Richardson Terrain Software
|
|
|
|
|
u move my question to yours
includeh10
|
|
|
|
|
|
Just curious. Why do you need to open the file faster? 10 ms isn't that bad,
depending on what you are doing.(Opening for read or read/write?)
jhaga
CodeProject House, Paul Watson wrote:
...and the roar of John Simmons own personal Nascar in the garage. Meg flitting about taking photos.Chris having an heated arguement with Colin Davies and .S.Rod. over egian values. Nish manically typing *censur*. Duncan racing around after his pet *c.* Michael Martin and Bryce loudly yelling *c.* C.G. having a fit as Roger Wright loads up *c.* . Anna waving her *c.* and Deb scoffing chocolates in the corner.
...Good heavens!
|
|
|
|
|
Hello All,
I have a SDI application in MFC.
By default, all the forms/windows (including the main form/window) and all the messageboxs will use this application's name as the title(caption).
However, I want to change the default titles/captions for this application to another name. How can I do it easily?
I know I can use the SetWindowText (or some similar functions) to set each window's caption one by one. But any better way to do it? How to change the "default" caption to what I want?
Thanks a lot and have a nice day.
|
|
|
|
|
You can't use SetWindowText() with the main or child frames. Use CMainFrame::OnUpdateFrameTitle() etc.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Modify the string table in the resource file.
Example:
Change IDR_MAINFRAME to the new name.
Trust in the code Luke. Yea right!
|
|
|
|
|
Yes, thanks, that's what I want.
|
|
|
|
|
I'm trying to create a vertical rebar.
I write something like this:
my_rebar.Create(this,RBS_BANDBORDERS|CCS_VERT,WS_CHILD|WS_VISIBLE|<br />
WS_CLIPSIBLINGS|WS_CLIPCHILDREN|CBRS_LEFT);<br />
my_rebar.AddBar(&my_toolbar);
But my rebar looks very strange.
Could you help me?
|
|
|
|
|
Hi everybody!
I have an MFC problem this week at work:
I write an application dynamically linked to MFC. This application is dynamically linked to one of my DLL, which is an MFC extension DLL, so it links MFC too.
When I build the DLL : no problem as in debug mode as in release mode.
But for the application : in debug mode, no problem, but runtime crash when I use the DLL fonctions (ASSERT fault), and in release mode, the program compile well but I have linkage error for each MFC symbol in my program, because the linker says that the MFC-symbols was already defined, in my DLL.
I try so tips to avoid this message, but I fail Does somebody know how to get ride of this problem? Thanks by advance!
PS : sorry for my english!
Signed Twofy.
There's only 10 kind of people : those who know binary and the others
|
|
|
|
|
hello
i search an article on animation in the site but i don't find(animation:how to make moving an objects made with OpenGl or other,and seem to walk or just deplace).
can you steer me on one article if it have one in the site.
thank you
|
|
|
|
|
Hey,
I used to program in school but haven't in some time.
What I'm trying to do is to write a batch file that would probably be used when a user logs onto the domain and does the following:
1) scans the pc for shared folders
2) turns the shares off
thats it.
I never programmed for something that do somthing like that. I wrote software like a menu based ordering system that Subway could use for making sandwhich's
any help is appreciated
|
|
|
|