wchar_t ch2 = L'\u27BA';
wchar_t ch = '\u27BA';
On Visual C++ 2003 SP1, no compiler warnings are given at all. However, ch
!= ch2.
Which one is correct?
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:st*****@ ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ] 9 1433
[Answering only in comp.lang.c++, where I read it]
"Maximus" wrote:
wchar_t ch2 = L'\u27BA';
wchar_t ch = '\u27BA';
On Visual C++ 2003 SP1, no compiler warnings are given at all.
However, ch != ch2.
Which one is correct?
The effects of placing a universal-character-name in a narrow
character literal (without the L in front) are implementation-
defined, you better ask in 'microsoft.publ ic.vc.language' . As to
warnings, none required since this is not ill-formed.
I would venture a guess that you need L there to be "correct",
since that makes the character literal to have the type 'wchar_t',
which is what you declare 'ch2'. Without the L, the type of the
character literal is 'char', and how it gets converted into the
'wchar_t' for 'ch' is implementation-defined.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
On Jun 12, 9:40 pm, maxi...@microso ft.com ("Maximus") wrote:
wchar_t ch2 = L'\u27BA';
wchar_t ch = '\u27BA';
On Visual C++ 2003 SP1, no compiler warnings are given at all. However, ch
!= ch2.
Which one is correct?
27BA is 10170.
'\u27BA' being of type char, it can't be greater than 255, assuming 8-
bit bytes. So it can't contain 10170.
L'\u27BA' being of type whar_t, which is on all implementations I know
at least 16 bits, it can contain 10170.
Therefore the correct one is the first one.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:st*****@ ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Mathias Gaunard wrote:
On Jun 12, 9:40 pm, maxi...@microso ft.com ("Maximus") wrote:
>wchar_t ch2 = L'\u27BA'; wchar_t ch = '\u27BA';
On Visual C++ 2003 SP1, no compiler warnings are given at all. However, ch != ch2.
Which one is correct?
27BA is 10170.
'\u27BA' being of type char, it can't be greater than 255, assuming 8-
bit bytes. So it can't contain 10170.
<nitpick>
Actually, it's implementation-defined. The standard only guarantees
that the upper value is no less than 127, however (IOW, the char is
at least 8-bits). On a PC 'chars' are 8-bit and ususally signed, so
they cannot contain any values above 127...
</nitpick>
[..]
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Victor Bazarov wrote in message...
Mathias Gaunard wrote:
On Jun 12, 9:40 pm, maxi...@microso ft.com ("Maximus") wrote:
wchar_t ch2 = L'\u27BA';
wchar_t ch = '\u27BA';
On Visual C++ 2003 SP1, no compiler warnings are given at all.
However, ch != ch2.
Which one is correct?
27BA is 10170.
'\u27BA' being of type char, it can't be greater than 255, assuming 8-
bit bytes. So it can't contain 10170.
<nitpick>
Actually, it's implementation-defined. The standard only guarantees
that the upper value is no less than 127, however (IOW, the char is
at least 8-bits). On a PC 'chars' are 8-bit and ususally signed, so
they cannot contain any values above 127...
</nitpick>
But (on win, P4):
std::cout<<" sizeof(wchar_t) ="<<sizeof(wcha r_t)<<std::endl ;
// out: sizeof(wchar_t) =2
--
Bob R
POVrookie
BobR wrote:
Victor Bazarov wrote in message...
><nitpick> Actually, it's implementation-defined. The standard only guarantees that the upper value is no less than 127, however (IOW, the char is at least 8-bits). On a PC 'chars' are 8-bit and ususally signed, so they cannot contain any values above 127... </nitpick>
But (on win, P4):
std::cout<<" sizeof(wchar_t) ="<<sizeof(wcha r_t)<<std::endl ;
// out: sizeof(wchar_t) =2
He talks about char, you talk about wchar_t. Makes no sense.
So I try it, too:
On linux, unknown machine:
std::cout<<" sizeof(double) = "<<sizeof(doubl e)<<std::endl;
// out: sizeof(double) = 8
--
Thomas http://www.netmeister.org/news/learn2quote.html
On Jun 14, 12:02 am, "BobR" <removeBadB...@ worldnet.att.ne twrote:
Victor Bazarov wrote in message...
Mathias Gaunard wrote:
On Jun 12, 9:40 pm, maxi...@microso ft.com ("Maximus") wrote:
>wchar_t ch2 = L'\u27BA';
>wchar_t ch = '\u27BA';
>On Visual C++ 2003 SP1, no compiler warnings are given at all.
>However, ch != ch2.
>Which one is correct?
27BA is 10170.
'\u27BA' being of type char, it can't be greater than 255, assuming 8-
bit bytes. So it can't contain 10170.
<nitpick>
Actually, it's implementation-defined. The standard only guarantees
that the upper value is no less than 127, however (IOW, the char is
at least 8-bits). On a PC 'chars' are 8-bit and ususally signed, so
they cannot contain any values above 127...
</nitpick>
But (on win, P4):
std::cout<<" sizeof(wchar_t) ="<<sizeof(wcha r_t)<<std::endl ;
// out: sizeof(wchar_t) =2
But the type of '\u27BA' is char. So the resulting value must
be in the range CHAR_MIN...CHAR _MAX; by default, with VC++,
-128...127 (but if the /J option is given, 0...255).
The reason he's seeing different values is precisely because the
type of '\u27BA' is char, but the type of L'\u27BA' is wchar_t,
in which the value fits.
--
James Kanze (GABI Software, from CAI) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
James Kanze wrote:
The reason he's seeing different values is precisely because the
type of '\u27BA' is char, but the type of L'\u27BA' is wchar_t,
in which the value fits.
Nothing precludes \u27BA from fitting in a char. While it is
true of Visual Studio he is using, it's not required by the
language. The 27BA is just a particular ISO character nothing
precludes it from being a valid value in the execution character
set (just not allowed to be part of the basic execution character
set).
Mathias Gaunard wrote:
On Jun 12, 9:40 pm, maxi...@microso ft.com ("Maximus") wrote:
>wchar_t ch2 = L'\u27BA'; wchar_t ch = '\u27BA';
On Visual C++ 2003 SP1, no compiler warnings are given at all. However, ch != ch2.
Which one is correct?
27BA is 10170.
'\u27BA' being of type char, it can't be greater than 255, assuming 8-
bit bytes. So it can't contain 10170.
Nothing says that \uXXXX maps directly into a character value. The
number after the u is an ISO 10646 (practically unicode) value. Do
not assume the execution character set is ASCII.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:st*****@ ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Thomas J. Gritzan <Ph************ *@gmx.dewrote in message ...
BobR wrote:
Victor Bazarov wrote in message...
<nitpick>
Actually, it's implementation-defined. The standard only guarantees
that the upper value is no less than 127, however (IOW, the char is
at least 8-bits). On a PC 'chars' are 8-bit and ususally signed, so
they cannot contain any values above 127...
</nitpick>
But (on win, P4):
std::cout<<" sizeof(wchar_t) ="<<sizeof(wcha r_t)<<std::endl ;
// out: sizeof(wchar_t) =2
He talks about char, you talk about wchar_t. Makes no sense.
Sorry. Somehow I missed the '\u' in there.
(All I seemed to see was '27BA is 10170'.)
Like: Who put that '\u' in there *after* I read the line? <G>
--
Bob R
POVrookie This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: H |
last post by:
This is a question that has haunted me for quite some time.
if you build a 4 tier database application where the 4th tier is the
database server (MS SQL 2000), where do you build the connection string?
The obvious answer is to hard code it into the middle layer and use a config
file.
The problem is the database application needs to be distributed to
purchasing clients. Therefore, you do not know, at development, what the SQL
|
by: lawrence |
last post by:
How is it possible that the question "How do I detect which browser
the user has" is missing from this FAQ:
http://www.faqts.com/knowledge_base/index.phtml/fid/125
and is only here on this with a link to old information that suggests
use of "navigator":
http://developer.irt.org/script/43.htm
|
by: Sean Dockery |
last post by:
Which is the following is correct?
a) <form ... onSubmit="return checkData()">
b) <form ... onSubmit="return checkData();">
c) <form ... onSubmit="checkData()">
d) <form ... onSubmit="checkData();">
|
by: Jean-David Beyer |
last post by:
I got this while reorganizing a database after doing perhaps a million
INSERTs. Not the best way to populate a relation, but the most practical.
Then I did a REORG and got this (looked up SQL2215N)
SQL2215N SQL error sqlcode occurred while committing previous work for the
database.
Explanation: The user was already connected to the database specified in
the Reorganize Table command. An error occurred while committing the
previous work...
|
by: mm nn |
last post by:
Hi,
I want to create a table like this:
ID Autonum
Datefld Date
Cat Text
Itm Text
tCount Number
| |
by: Skybuck Flying |
last post by:
Hi,
I needed a method to determine if a point was on a line segment in 2D. So I
googled for some help and so far I have evaluated two methods.
The first method was only a formula, the second method was a piece of C code
which turned out to be incorrect and incomplete but by modifieing it would
still be usuable.
The first method was this piece of text:
|
by: mflll |
last post by:
I am looking into the different techniques of handling arrays of edit
boxes in
Java Script. The first program below works fine. However, are there
better ways of
doing this, where the person writing the JavaScript doesn't have to
pass the index
in the "onChange" event name.
I thought that one might be able to use "this.value" or compare this as
|
by: =?ISO-8859-1?Q?Tom=E1s_=D3_h=C9ilidhe?= |
last post by:
If you have:
#define errno retrieve_errno_func()
#define SUBSYSTEM_INCLUDE(subsystem, file) <subsystem/include/file>
then what should happen when you do:
|
by: readnlearn |
last post by:
hai,
i have written this below code for displaying captcha image whenever i entered incorrect uname,password in login page.
for that i disable the controls of captcha like textbox,labels,button and image control in source code of designing part.
and i enable those controls in an if condition which display captcha.
but if i entered correct information which is in database
it shouldn't navigate to the corresponding page
and also if entered...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |