|
prasad_som wrote: Again, these are not keywords. they are just defines for backword compa. And it doesn't expand in to empy string. It is just define.
Empty string meant expands to nothing.
prasad_som wrote: char *pcVDUStart = 0xB8000000;
You are talking of Win32 but I am talking about programming in DOS. All the above statements were in relation to programming in DOS as I started of programming in DOS.
|
|
|
|
|
prasad_som wrote: No, empty string means "".
Yes but here expands to nothing .
|
|
|
|
|
prasad_som wrote: There is difference betn "expands to nothing" and "expands to "" ".
Yes there is but here I meant expands to nothing...
From MSDN...
Because the types NEAR and FAR are defined in WINDEF.H, they are
automatically handled by the include file, which redefines them as
<code>empty strings </code>for Win32. Thus, NEAR and FAR are ignored.
If you do not include WINDEF.H, a convenient solution is to use
the /D command-line option to replace the keywords by <code>empty
strings</code>. For example:
/D_near= /D_far= /D__near= /D__far=
|
|
|
|
|
Hi,
I have a project in which there are lots of places where a double is directly converted into an int without any explicit cast. Is there a way by which I can get warning in all the places where something like this happens.
The gcc compiler shows a warning something like "warning: converting to ‘int’ from ‘double’" but the with the same code vc++ compiler is not showing any warning.
Any idea how I can get these warnings?
Thanks a lot!!
|
|
|
|
|
You need to use warning level 4.
Use Project Setting-->C/C++-->General-->Warning level .
But it is not recommended to this level. As, warnings though this level can be safely ignored.
|
|
|
|
|
I tried setting the warning level to 4, but it is still not showing these kind of warnings.
|
|
|
|
|
Rebuild and see. There will be lots of warnings. You need to locate for this particular.
|
|
|
|
|
No, I am not getting any such warning.
Please help
Thanks a lot!!
|
|
|
|
|
Can you show code, you are expecting to generate this warning ? Which IDE you are using ?
|
|
|
|
|
The code is something like
<br />
class Value<br />
{<br />
public:<br />
Value(double v);<br />
double getValue() const;
private:<br />
double val;<br />
};<br />
<br />
int main()<br />
{<br />
Value v1(11.0);<br />
int a = v1.getValue();
}<br />
gcc generates warning for this but the vc++ compiler is not generating any warning. I am Visual Studio .net 2002.
Thanks a lot
|
|
|
|
|
This clearly generates warning with level 4 on VC6 and with level 3 on VS2K5 .
Mithin wrote: I am Visual Studio .net 2002
I dont have this IDE to test. But that should not be problem. I thing you are not setting warning level properly.
Test this code with VC6 .
|
|
|
|
|
prasad_som wrote: You need to use warning level 4.
...
But it is not recommended to this level. As, warnings though this level can be safely ignored.
Not? I always set my projects to warning level 4 and try my best to eliminate all warnings.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
PJ Arends wrote: Not? I always set my projects to warning level 4 and try my best to eliminate all warnings.
Same here. To suggest otherwise is bad advise.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
The version of STL that came with VC6 would overwhelm you with warnings, but later versions have fixed that. Even with VC6 a couple of pragmas in the stdafx.h header file would eliminate those errors. There is an article somewhere here on CP on how to do that.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
PJ Arends wrote: The version of STL that came with VC6 would overwhelm you with warnings, but later versions have fixed that.
True.
As mentioned earlier, this particular warning is level 3 though in VS2K5 .
|
|
|
|
|
prasad_som wrote: But it is not recommended to this level. As, warnings though this level can be safely ignored.
I don't think that an implicit conversion from double to int should be ever safely ignored.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Yes. I was refering to level 4 warnings. As you can see my further posts about this particular warning. Should be treated as level 3 warning and it is level 3 warning in VS2k5 .
|
|
|
|
|
I used a COleDateTime variant and also has initialized it, but when I want to store it in a CString object, using the Format(...) function,there would be some wrong: it refuse to work!.
somebody would tell me why,and how to resolve it?
Thanks Very Much!
|
|
|
|
|
It seems to work for me. Try this:
COleDateTime dt(1971, 6, 12, 12, 0, 0);
CString s = dt.Format();
AfxMessageBox(s);
Steve
|
|
|
|
|
Can you show code, what you are trying ?
|
|
|
|
|
COleDateTime time(1996,1,1,0,0,0);
int status=time.GetStatus();
cout<
|
|
|
|
|
kcynic wrote: str=time.Format("%Y %m %d %H:%M:%S");//Wrong
Whats wrong here ? I can see its formating time , as it should.
i.e. "1996 01 01 00:00:00"
|
|
|
|
|
I have created a class file and class header- in the header I save version,file name, and # of last file saved
then everything after that is the file storage.. The problem I am having is: my index has a bug-
reading the file:
file k[150];
header hdrs;
ifstream op("file.dat",ios::nocreate);
op.read(reinterpret_cast <char*> (&hdrs),sizeof(header));
op.read(reinterpret_cast <char*> (&k),hdrs.index * sizeof(file));
saving the file:
strcpy(k[hdrs.index].first_name,s);
m_last.GetWindowText(f);
strcpy(k[hdrs.index].last_name,f);
ofstream fi("file.dat",ios::nocreate);
if(!fi.is_open())
{
MessageBox("File failed!","",MB_OK);
}
hdrs.index++;
s.Format("File Storage system");
strcpy(hdrs.title,s);
s.Format("1.0");
strcpy(hdrs.version,s);
fi.seekp(0,ios::cur);
fi.write(reinterpret_cast <char*> (&hdrs),sizeof(header));
fi.write(reinterpret_cast <char*> (&k),hdrs.index * sizeof(file));
fi.close();
after saving a number of data items the index looses count and gives me a number:-858993460
It works sometimes for a while before loosing count and other times right off the start..
any ideas why?
-- modified at 20:15 Monday 8th January, 2007
|
|
|
|
|
I can't see and "<"s or ">"s in your code. This makes it hard to see what you're casting to.
Steve
|
|
|
|
|
"<"char * ">"
sorry, did not notice it would not show up!
|
|
|
|