isodigit

J

JoseMariaSola

The standard defines isdigit and isxdigit but doesn't say anything
about isodigit (testing for octal digits).
Anyone knows why?
Thanks.
Joey.
 
R

Richard Bos

JoseMariaSola said:
The standard defines isdigit and isxdigit but doesn't say anything
about isodigit (testing for octal digits).
Anyone knows why?

No, but it's simple to define, since the Standard does demand that '0'
through '7' are subsequent.

Richard
 
J

JoseMariaSola

The standard defines isdigit and isxdigit but doesn't say
No, but it's simple to define, since the Standard
does demand that '0'through '7' are subsequent.
Then it's also simple to define isdigit, but the standard defines it
and doesn't leave the definition to us.
Why isn't that the case with isodigit?
 
I

Ian Collins

JoseMariaSola said:
Then it's also simple to define isdigit, but the standard defines it
and doesn't leave the definition to us.
Why isn't that the case with isodigit?
No one thought of it? You could try asking on comp.std.c

As Richard said, it is trivial to define.
 
R

robertwessel2

Then it's also simple to define isdigit, but the standard defines it
and doesn't leave the definition to us.
Why isn't that the case with isodigit?


I suspect there are two reasons. One a lack of interest, especially
given how trivial it would be implement yourself (really? you
actually have some a purpose for isodigit?). Second, adding another
ctype class would probably require a bigger lookup table (assuming the
typical design) on many small C implementations, for darn little good
reason. If you have eight bit chars, and can live with some
restrictions* on what different locales can do to the ctype classes,
you can implement everything (except toupper/lower) with a single 256
(usually 257) byte table. Add another class, and you either need 256
shorts, or a second table.


*Specifically, you have to disallow locales that have characters in
isalpha that are not in islower or isupper, or with characters in
isspace that are not in isprint or iscntrl. Which are actually a
common conditions for compilers targeting small embedded systems,
which often restrict themselves to just the C locale.
 
C

CBFalconer

JoseMariaSola said:
Then it's also simple to define isdigit, but the standard
defines it and doesn't leave the definition to us. Why isn't
that the case with isodigit?

I don't know. Why doesn't the standard library contain a routine
to flim my diddle? I suspect the answer is the same.
 
S

santosh

Then it's also simple to define isdigit, but the standard defines it
and doesn't leave the definition to us.
Why isn't that the case with isodigit?

It's trivial to implement isodigit() in terms of isdigit().
 
P

Philip Potter

CBFalconer said:
I don't know. Why doesn't the standard library contain a routine
to flim my diddle? I suspect the answer is the same.

Because they didn't know what octal numbers are?
 
C

Chris Dollin

JoseMariaSola said:
Then it's also simple to define isdigit, but the standard defines it
and doesn't leave the definition to us.
Why isn't that the case with isodigit?

I /guess/ that when C was standardised, `isdigit` and `isxdigit` were in
widespread use, but `isodigit` (which I can't help but read as `iso-digit`)
wasn't.

History: things that happened that leave traces in the present.
 
R

Richard Tobin

Chris Dollin said:
I /guess/ that when C was standardised, `isdigit` and `isxdigit` were in
widespread use, but `isodigit` (which I can't help but read as `iso-digit`)
wasn't.

It may be relevant that in early C, the digits 8 and 9 were allowed in
octal constants.

-- Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top