Wrox Programmer Forums
|
BOOK: Ivor Horton's Beginning Visual C++ 2010
This is the forum to discuss the Wrox book Ivor Horton's Beginning Visual C++ 2010 by Ivor Horton; ISBN: 9780470500880
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Ivor Horton's Beginning Visual C++ 2010 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 12th, 2012, 03:55 AM
Registered User
 
Join Date: Jun 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Unsetting the character set

Hello,

In Chapter 1 the book says that you need to set the Character Set property to "Not set" or else all win32 projects won't build. Why is that? also I have tried leaving it to unicode and the project built and ran successfully.
 
Old June 15th, 2012, 02:38 AM
Authorized User
 
Join Date: May 2012
Posts: 66
Thanks: 0
Thanked 4 Times in 4 Posts
Default

osmak,

I have asked myself the same question. Like you, I also found that the programs I have written so far compile without choosing not set in properties.

I am no expert, and I am using the book for independent study (not any school course). Based on some basic knowledge and research, I can speculate why the author has included the passage you are referring to. Logically the explanation which follows makes good sense to me.

ASCII is single bit code which allows 256 distinct characters. These characters can be produced by a standard keyboard and are more or less English language oriented. Unicode is two bit code which allows 65,536 characters. The extra character set supported by Unicode allows characters used by other languages to be understood by the computer. For example to have a functional understanding of Japanese, you must know about 1000 characters out of the 50,000 total character set. In Chinese you must know about 1000 characters out of the 80,000 total character set.

How does this apply to C++ Win32 projects?
An over simplified explanation here will prevent attempting to deal with concepts which will be discussed in detail later in the book. An essential part of the programming knowledge deals with strings. Strings are a collection of characters. The programming language and compiler join forces to allocate memory to store strings and variables. So far I have presented only fact.

Now I will deal with speculation based on the facts as I understand them. C++ reserves one byte of memory to store characters. (2 raised to the 8th power = 256 characters) Unicode is two bytes in size. (2 raised to the 16th power = 65,536 characters) I am beginning Chapter 3. I don't know how far into the book you are right now. The programs to this point have not been dealing with character or string manipulation.

When we get to character and string manipulation I expect a conflict if properties are set to use Unicode. The compiler will be expecting to use two bytes of memory where C++ is specifying one byte of memory. I would anticipate a compiler error pointing to a problem with memory allocation or a type conflict. Furthermore if properties are chosen as not set, I expect the compiler to allow the C++ code to determine the type and memory allocation.

If you have programmers at work or are in school and have programming instructors available, you may be able to bounce my speculation off them to see if I speculate correctly. I sure would like to know if I connected the dots right on this.

drpepper





Similar Threads
Thread Thread Starter Forum Replies Last Post
Same character set output by pressing any key.... anilsaroliya Visual Basic 2005 Basics 1 May 18th, 2007 11:20 AM
character set problem BrendonMelville Java Basics 1 March 15th, 2007 12:16 PM
Character set muthukumar Oracle 0 November 8th, 2005 12:49 AM
How to set DOM character set sonicDace XML 0 May 27th, 2004 08:52 AM
XMLDOM default character set sonicDace XML 0 May 21st, 2004 03:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.