delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/05/20/04:16:37

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: ctype<char> custom table lookup in C++
Date: 20 May 2005 08:03:36 GMT
Lines: 28
Message-ID: <3f5juoF5og3rU2@news.dfncis.de>
References: <1116546092 DOT 867392 DOT 97940 AT g43g2000cwa DOT googlegroups DOT com>
X-Trace: news.dfncis.de m98YfJ4fEwpoTZOgnNve5A29h1Tsf9ArYs/7WslxeEO8Tj5veIMpD9CpIQ
X-Orig-Path: not-for-mail
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Carey Evans <carey DOT evans AT gmail DOT com> wrote:
> I've been trying to write a custom C++ ctype<char> facet to support the
> full range of characters in codepage 850, not just ASCII.  However,
> I've run across a problem with the ctype<char>::is(mask,char) lookup on
> the custom table I pass to the ctype<char> constructor.

> The ISO C++ standard says of is(mask m, char c) that:

> > The first form returns table()[(unsigned char)c] & m; ...

I find it hard to believe the C++ would actually predefine the
implemention of a given feature.  That's none of their business.

> but with GCC 3.4.3 in DJGPP, it returns (from ctype_inline.h):

> > _M_table[static_cast<unsigned char>(__c + 1)] & __m;

> which means that all the character classifications in my custom class
> are off by one.

Only if you misunderstand how that table is supposed to be
constructed, in the case of DJGPP.  The C++ standard seems to have
forgotten about the C specialty of passing EOF into a <ctype.h>
library macro/function.

-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


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