Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Jul 1997 09:11:20 -0700 (PDT)
From:      "Jonathan M. Bresler" <jmb>
To:        joerg_wunsch@uriah.heep.sax.de
Cc:        r.carey@dcs.napier.ac.uk, hoek@hwcn.org, freebsd-bugs@freebsd.org
Subject:   Re: ispunct(3) [was: FreeBSD-2.1.1]
Message-ID:  <199707141611.JAA29062@hub.freebsd.org>
In-Reply-To: <19970714152834.RR49021@uriah.heep.sax.de> from "J Wunsch" at Jul 14, 97 03:28:34 pm

next in thread | previous in thread | raw e-mail | index | archive | help
	i have delayed mailing list because
	i have been looking for the reference but have not found it.

	ispunct() is only useful for ASCII input.
	the correct way to use ispunct() and the rest of the functions
	listed in ctype(3) is to call isascii() first

	if (isascii(a) && ispunct(a)) {
		/* it is punctuation */
	} 
	/* either its not ASCII or its not punctuation */
jmb

ps.  arghh...old age, where was that reference ;)

J Wunsch wrote:
> 
> As Robin Carey wrote:
> 
> > And my results were different; ispunct(3) was returning TRUE for chars
> > above 127 .....
> 
> Right.  As the standard says: printing character, except letter or
> digit or space.
> 
> > Oh ... the manual page doesn't mention anything about characters other
> > than ASCII. Doesn't that mean ispunct(3) is not "ANSI C" standard then ?
> 
> AFAIK, ANSI C doesn't mention anything beyond ASCII, so the behaviour
> is simply undefined.  Extending the default behaviour to ISO Latin-1
> seems to be a reasonable interpretation of `undefined'.
> 
> If you restrict the domain of the isfoo() functions to ASCII, you are
> not bitten by this.  If you don't, you have another problem anyway
> (since you're relying on undefined behaviour).
> 
> -- 
> cheers, J"org
> 
> joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
> Never trust an operating system you don't have sources for. ;-)
> 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707141611.JAA29062>