ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-apps/2002/04/28/15:39:34

Mailing-List: contact cygwin-apps-help AT cygwin DOT com; run by ezmlm
Sender: cygwin-apps-owner AT cygwin DOT com
List-Subscribe: <mailto:cygwin-apps-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-apps/>
List-Post: <mailto:cygwin-apps AT cygwin DOT com>
List-Help: <mailto:cygwin-apps-help AT cygwin DOT com>, <http://sources.redhat.com/lists.html#faqs>
Mail-Followup-To: cygwin-apps AT cygwin DOT com
Delivered-To: mailing list cygwin-apps AT cygwin DOT com
From: "Gary R. Van Sickle" <g DOT r DOT vansickle AT worldnet DOT att DOT net>
To: "Cygwin-Apps" <cygwin-apps AT cygwin DOT com>
Subject: RE: libgetopt++ and setup and libstdc++
Date: Sun, 28 Apr 2002 14:38:47 -0500
Message-ID: <NCBBIHCHBLCMLBLOBONKEEOMCNAA.g.r.vansickle@worldnet.att.net>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
In-Reply-To: <FC169E059D1A0442A04C40F86D9BA7600C5F3E@itdomain003.itdomain.net.au>
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Importance: Normal

> > There's a cute 'trick' here that gives you the best of both worlds:
> >
> > typedef basic_string< TCHAR > StringAW;
> >
> > Now the "StringAW" type is either wide or narrow depending on
> > build-time defines.
>
> Except that widechar != unicode. WCHAR is still an 0 terminated string,
> but Unicode strings are not 0 terminated.

Sure they are.  A Unicode '\0' == 0x0000 (regardless of your byte order ;-)).
That said, basic_string<> doesn't actually store a '\0'; it stores the string
length, and only "nullifies" things when you do a ".c_str()" [Eckel, "Thinking
in C++", 2nd ed. Volume 2].

> (See the NT kernel defines for
> UNICODE_STRING to see how unicode strings are represented.).
>

Right, but we're not in Kernel space here (thank the three men I admire most,
the Father, Son, and the Holy Ghost!).  Everything is different (and usually
wrong) in Kernel mode.  The UNICODE Win32 API takes null-terminated UNICODE
strings as parameters.

Great, now I'm having flashbacks.  That's that PWDMSD (Post-Windows-Driver-Model
Stress Disorder) for ya.

> Anyway, as we need more than the base string class offers, I see no
> reason not to have our own string class..

Oh, I completely agree.  I'm just saying that we could probably base it on
basic_string< TCHAR > and be one step ahead of the future.

--
Gary R. Van Sickle
Brewer.  Patriot.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019