473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Problem with debug IDE displaying value of __int64

I get odd behavior in the debugger with the following code. The output of
the program itself is correct, but when I add the g_bad_int64_max and
g_bad_int64_min to the watch window they show values of -1 and 0
repsectively. This only happens when initializing a const __int64 in global
scope with a literal constant. I fooled around with the initial value and it
looks like the upper 32 bits are being ignored. Is this a known issue?

#include <iostream>
#include <limits.h>

using namespace std;

//This is displayed incorrectly in debugger
const __int64 g_bad_int64_max = LLONG_MAX;
const __int64 g_bad_int64_min = LLONG_MIN;

// This works
__int64 g_int64_max_initializer = LLONG_MAX;
__int64 g_int64_min_initializer = LLONG_MIN;
const __int64 g_good_int64_max = g_int64_max_initializer;
const __int64 g_good_int64_min = g_int64_min_initializer;

main()
{
// This works
const __int64 my_int64_max = LLONG_MAX;
const __int64 my_int64_min = LLONG_MIN;

cout << "\n g_bad_int64_max: " << g_bad_int64_max
<< "\n g_bad_int64_min: " << g_bad_int64_min
<< "\n g_odd_int64_max: " << g_good_int64_max
<< "\n g_good_int64_min: " << g_good_int64_min
<< "\n my_int64_max: " << my_int64_max
<< "\n my_int64_min: " << my_int64_min
<< endl;

}

--
Jesse
Nov 17 '05 #1
1 1672
"=?Utf-8?B?SmVzc2UgSG9zZQ==?="
<Je*******@discussions.microsoft.com> wrote in
news:8D**********************************@microsof t.com:
I get odd behavior in the debugger with the following code. The
output of the program itself is correct, but when I add the
g_bad_int64_max and g_bad_int64_min to the watch window they
show values of -1 and 0 repsectively. This only happens when
initializing a const __int64 in global scope with a literal
constant. I fooled around with the initial value and it looks
like the upper 32 bits are being ignored. Is this a known
issue?


It's a bug in VS2003. This is fixed in VS2005.

Thanks,
--
Tarek Madkour, Visual C++ Team
This posting is provided "AS IS" with no warranties, and confers
no rights.
Nov 17 '05 #2

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

Similar topics

5
by: Jeff | last post by:
IDE: VS 2003 :NET OS: XP Pro My app have a form with a tab-control on it. The tab-control have 2 tabpages. One of the tabpages displays a datagrid, and the other tabpage displays details (order...
17
by: Peter Bromley | last post by:
The following code snippet does not seem to work correcly unsigned __int64 result = 0xFFFFFFFFFFFFFFFF; result = result << 64; Debugger.WriteLine(System::String::Format(S"{0:X16}",...
12
by: Rob T | last post by:
I'm storing a date/time into a SQL table of type datetime. I need it to be precise so the value is stored to the 1000th of a second. ie "insert into myTable mydate values ('08/05/2005...
4
by: Kio | last post by:
Hi, For example: 1 __int64 fib4(__int64 n) 2 { 3 if ((n==1) || (n==2)) return 1; 4 else return (fib(n-1)+fib(n-2)); 5 }
4
by: kgpsoftware | last post by:
Hi folks, I have a DLL which contains functions that return __int64 values, but I can't get Visual C to read the return value correctly. I am using the 2003 version. Here is the declare: ...
5
by: Toto | last post by:
Hello, I've got a problem with the redefinition of operator in C++. My intent is to create a TVector that internally work with __int64, with an external interface of double in order to optimize...
0
by: madhu | last post by:
Hi all I have a problem in this code which deletes all the prvious folders. If you have any idea please give it. Thanks in advance. Madhukar Arvind Kumar void CHtmlGeneratorDlg::OnAdd() {...
5
by: xmllmx | last post by:
Please forgive me for cross-posting. I've post this to microsoft.publoc.vc.mfc. But I can't get any response. Maybe only MFC- related topics are cared there. To begin with code: union XXX {...
3
by: imaloner | last post by:
I am posting two threads because I have two different problems, but both have the same background information. Common Background Information: I am trying to rebuild code for a working,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
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...

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.