| | |
C preprocessor
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Something like this?
By the way, Unicode is only an encoding, not a storage specification. The actual storage is with multi-byte characters that happen to represent Unicode codes. Technically, you can use Unicode with single byte characters as long as you restrict yourself to the single byte Unicode values.
C Syntax (Toggle Plain Text)
#include <stdio.h> #include <wchar.h> #define UNICODE(x) L#x int main ( void ) { wchar_t *p = UNICODE ( xyz\n ); fputws ( p, stdout ); return 0; }
New members chased away this month: 4
•
•
Join Date: Dec 2005
Posts: 4
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by Narue
Something like this?
By the way, Unicode is only an encoding, not a storage specification. The actual storage is with multi-byte characters that happen to represent Unicode codes. Technically, you can use Unicode with single byte characters as long as you restrict yourself to the single byte Unicode values.C Syntax (Toggle Plain Text)
#include <stdio.h> #include <wchar.h> #define UNICODE(x) L#x int main ( void ) { wchar_t *p = UNICODE ( xyz\n ); fputws ( p, stdout ); return 0; }
Thanks a lot for your post.
you can use that macro anywhere you use a string literal. You can't, however, use that macro with a char*
C Syntax (Toggle Plain Text)
// this will NOT work char* hello = "Hello World"; wchar_t thello = UNICODE(hello);
•
•
•
•
Originally Posted by Ancient Dragon
you can use that macro anywhere you use a string literal. You can't, however, use that macro with a char*
C Syntax (Toggle Plain Text)
// this will NOT work char* hello = "Hello World"; wchar_t thello = UNICODE(hello);
New members chased away this month: 4
•
•
•
•
Originally Posted by Narue
Your point being? There was never any assumption that the macro would be used with narrow string variables, unless you were reading a few posts that I conveniently missed. Or are you just posting pointless fluff to make yourself look smart when you can't find anything meaningful to add?
or are you suffering from pms today :mrgreen:you might (or might not) be supprised at the number of people I've see try to do what I mentioned, so its not an unreasonable thing to warn people about.
>getting pretty snotty now aren't you
or are you suffering from pms today :mrgreen:
That was pretty sharp-tongued, even for me.
I was suffering from arrogant forumgoers trying to show off their brilliance by incorrectly "correcting" me with meaningless crap. But you wouldn't do that...more than once.
>you might (or might not) be supprised
I'm very surprised, actually, since it's immediately obvious what the macro does and that it only works with string literals. Though I shouldn't be surprised, with the rampant idiocy of many programmers. :rolleyes:
>Unicode is not an encoding
From dictionary.com:
From unicode.org (emphasis is mine):
Now, it's entirely possible that the Unicode Consortium doesn't know what encoding means, or hired someone to write their FAQ who doesn't know what encoding means, or you're being far too pedantic and making mistakes in the process. 
How about we meet halfway and call Unicode a code table? I respect you too much to flame you out of existence.
or are you suffering from pms today :mrgreen:That was pretty sharp-tongued, even for me.
I was suffering from arrogant forumgoers trying to show off their brilliance by incorrectly "correcting" me with meaningless crap. But you wouldn't do that...more than once.
>you might (or might not) be supprised
I'm very surprised, actually, since it's immediately obvious what the macro does and that it only works with string literals. Though I shouldn't be surprised, with the rampant idiocy of many programmers. :rolleyes:
>Unicode is not an encoding
From dictionary.com:
•
•
•
•
encoding: Computer Science. To format (electronic data) according to a standard format.
•
•
•
•
Q: What is Unicode?
A: Unicode is the universal character encoding, maintained by the Unicode Consortium. This encoding standard provides the basis for processing, storage and interchange of text data in any language in all modern software and information technology protocols.

How about we meet halfway and call Unicode a code table? I respect you too much to flame you out of existence.
New members chased away this month: 4
I don't think so. What is generally called a character encoding, they call a Character Encoding Scheme. See http://www.unicode.org/glossary/. And their definition of Coded Character Set would characterize Unicode nicely. Their glossary doesn't give a definition of character encoding, probably because they've avoided using the term because it's sometimes used in different ways. I would not call a numbering of a series of characters an encoding.
To say that "Unicode is just an encoding" is misleading, because "character encoding" normally refers to the storage specification, such as UTF-8 or UTF-16BE. This is how the term is usually used, and their FAQ goes against the norm. (I'm basing what I call the 'norm' from looking at the View > 'Character Encoding' menu in Firefox, the 'Encoding' menu in I.E., and just about every link I've looked at in a Google search for 'unicode character encoding'.)
To say that "Unicode is just an encoding" is misleading, because "character encoding" normally refers to the storage specification, such as UTF-8 or UTF-16BE. This is how the term is usually used, and their FAQ goes against the norm. (I'm basing what I call the 'norm' from looking at the View > 'Character Encoding' menu in Firefox, the 'Encoding' menu in I.E., and just about every link I've looked at in a Google search for 'unicode character encoding'.)
All my posts may be redistributed under the GNU Free Documentation License.
![]() |
Similar Threads
- Preprocessor definitions on the command line (C++)
- Preprocessor directives (Visual Basic 4 / 5 / 6)
- Preparing for an interview and need some questions answered (C)
- re: Sorting Algorithms (C++)
- Error Linking KeyLogger.exe (C++)
Other Threads in the C Forum
- Previous Thread: remove method linked list
- Next Thread: mock test question, can anyone help
| Thread Tools | Search this Thread |
Tag cloud for C
#include * append array arrays asterisks binarysearch calculate changingto char character cm command copyimagefile cprogramme creafecopyofanytypeoffileinc database directory dynamic execv feet fgets file fork forloop framework function functions givemetehcodez grade graphics gtkwinlinux hacking histogram homework include incrementoperators input intmain() iso kernel keyboard km lazy license linked linkedlist linux list lists locate logical_drives looping loopinsideloop. lowest matrix microsoft motherboard mqqueue number oddnumber odf opensource overwrite owf pdf performance pointer posix problem probleminc process program programming radix recursion recv recvblocked research reversing scanf scripting segmentationfault sequential socket socketprograming spoonfeeding standard string student systemcall testing threads turboc unix user variable wab whythiscodecausesegmentationfault windowsapi






