www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/16/21:11:43

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro Wierdness (fix class)...
Date: Wed, 15 Jan 1997 22:45:26 +0000
Organization: None
Lines: 22
Distribution: world
Message-ID: <krb6dBAG4V3yEwe2@talula.demon.co.uk>
References: <5b8rfb$2da8 AT elmo DOT cadvision DOT com>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

frenchc writes:
>I'm finding the allegro fix class to be a bit wierd. The overloaded
>operators seem to work ok, but why are the trig functions implemented the
>way they are? Is there something i'm not getting? Shouldn't they be
>designed to make the following possible:
>
>fix F, G;
>(whatever) = F.cos();
>(whatever) = F.sin();
>(whatever) = F.atan2( G );

What's wrong with just calling cos(F)? Allegro overloads the standard
function names, so if you call cos on a float you will get the standard
libc version, while if you pass it a fix object you'll get Allegro's
version. That seems to me to be simpler than having it as a member
function: my goal was to make the class as behave as similarly as
possible to the native C syntax for ints and floats...

/*
 *  Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
 *  Ghoti: 'gh' as in 'enough', 'o' as in 'women', and 'ti' as in 'nation'.
 */

- Raw text -


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