delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/08/05/14:25:31

Message-ID: <37A9C40C.ABBC94D5@softhome.net>
Date: Thu, 05 Aug 1999 19:04:12 +0200
From: Laurynas Biveinis <lauras AT softhome DOT net>
X-Mailer: Mozilla 4.61 [en] (Win98; I)
X-Accept-Language: lt,en
MIME-Version: 1.0
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
CC: DJGPP Workers <djgpp-workers AT delorie DOT com>
Subject: Re: CPU ID program, second version
References: <Pine DOT SUN DOT 3 DOT 91 DOT 990805175845 DOT 16775A-100000 AT is>
Reply-To: djgpp-workers AT delorie DOT com

Eli Zaretskii wrote:
> 
> On Thu, 5 Aug 1999, Laurynas Biveinis wrote:
> 
> > > Also, your switch statement is incomplete -- add a default case and
> > > call it "ix86" or something like that.
> >
> > It currently handles all cases - first CPU's with CPUID instruction
> > are 486 and Pentiums. And currently there is no CPU which reports
> > bigger value in "instruction family" field than 0x6 (for i686).
> 
> Nevertheless, switch statements with no default are generally a bad
> idea.  A library function shouldn't have undefined behavior in
> unforseen circumstances.
> 
> I think returning i486 as the default in the last switch is good
> enough.  Do you agree?

Well, i486 would be a safe bet, but it is more likely that 
unrecognized CPU will be later than i686. ("i786"?) So
returning "i686" as default would be more exact but also
*much* more dangerous.

Laurynas Biveinis

- Raw text -


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