473,503 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Warning C4800

I have a little issue I hope you can help me with. I retrieve the processes
that are running on my computer and get the C4800 warning in certain
situations. The code snippet below illustrates my challenge.

Process* localAll[] = Process::GetProcesses();

printf("\nProcess name: %s",localAll[x]->ProcessName); //works fine

cout << "Process name: " << localAll[x]->ProcessName << endl; //c4800

// writing to a file

writeFile << "Process name: " << localAll[x]->ProcessName << endl; //c4800

warning C4800: 'System::String __gc *' : forcing value to bool 'true' or
'false' (performance warning)

Why does it work with 'printf' but not with the others?
Nov 17 '05 #1
1 2079
I'm sorry I can't exactly tell you the solution to your problem, but
printf takes whatever parameters you pass, so it doesn't exspect
anything. cout, however, seems to exspect a boolean value in this
situation. I doubt that there is an operator (<<) defined for cout which
takes a System::String as parameter, but I am not sure about this. So
maybe the compiler tries to pass a boolean value instead of a String --
try converting to a C-style string before passing it to cout or
writeFile.

Regards,
Felix Arends
-----Original Message-----
From: Jazzkt [mailto:ja**@msn.com]
Posted At: Tuesday, September 07, 2004 5:40 PM
Posted To: microsoft.public.dotnet.languages.vc
Conversation: Warning C4800
Subject: Warning C4800
I have a little issue I hope you can help me with. I
retrieve the processes that are running on my computer and
get the C4800 warning in certain situations. The code
snippet below illustrates my challenge.

Process* localAll[] = Process::GetProcesses();

printf("\nProcess name: %s",localAll[x]->ProcessName); //works fine

cout << "Process name: " << localAll[x]->ProcessName << endl; //c4800

// writing to a file

writeFile << "Process name: " << localAll[x]->ProcessName <<
endl; //c4800

warning C4800: 'System::String __gc *' : forcing value to
bool 'true' or 'false' (performance warning)

Why does it work with 'printf' but not with the others?


Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2703
by: Bas Wassink | last post by:
Hello there, I'm having trouble understanding a warning produced by 'splint', a code-checker. The warning produced is: keywords.c: (in function keyw_get_string) keywords.c:60:31: Released...
3
2543
by: Bill Burris | last post by:
How do I find what is causing this warning from the Linker? If I use /NODEFAULTLIB I get hundreds of undefined symbols. LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other...
12
3236
by: Howard Kaikow | last post by:
In the code below, ALL the lines that start with PPTfile << are getting the following error at build time. "//i:\C++\C++Code\FileOperations\Form1.h(127) : warning C4800: 'System::String __gc *'...
3
7178
by: DJTN | last post by:
I'm getting the following error when I try to compile my setup project in VS 2002. I have re-installed the .net framework 1.1 and it didnt solve the problem. WARNING: Unable to find dependency...
1
1977
by: spanov | last post by:
i've got problem installing python-2.3.5 from sources on FreeBSD 5.3 root@server# ./configure > conf_log configure: WARNING: curses.h: present but cannot be compiled configure: WARNING:...
0
2394
by: Manish | last post by:
PHP INI File Setting ------------------------------------------------------------------------------------------------------------------ error_reporting = E_ALL & ~E_NOTICE No warning message are...
1
6385
by: Ian | last post by:
I've just discovered the msclr::lock class in the C++ Support Library online documentation. This seems like a much cleaner way to implement thread protection than using...
92
6116
by: Heinrich Pumpernickel | last post by:
what does this warning mean ? #include <stdio.h> int main() { long l = 100; printf("l is %li\n", l * 10L);
4
2139
by: cody | last post by:
It is possible to declare and use/instantiate a class with a uninitialized readonly field without even a compiler warning. Why don't I get warnings? public class Stuff { public readonly int a;...
0
7201
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7083
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7278
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6988
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7456
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5011
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
379
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.