Adam Wiggins wrote:

> I'm using egcs 1.1.1.  The following code:
>
> (line 154)
>   Vector2  texEnd(float(sFontWidth[index]*2),float(-sFontHeight[index]*2));
> (line 180)
>   gfxCard::Draw2D(Vector2(xIter+2,pos.y-2),dimensions,fontTable[*c],texEnd);
>
> produces the error:
>
> text.cpp:154: parse error before `*'
> text.cpp:180: no matching function for call to `gfxCard::Draw2D (Vector2,
> Vector2 &, Vector2 &, Vector2 ()(...))'
> /home/uvatha/trex/render/card.h:23: candidates are: gfxCard::Draw2D(const
> Vector2 &, const Vector2 &, const Vector2 &, const Vector2 &)
>
> However, changing line 154 to read:
>
>  Vector2 texEnd((float)(sFontWidth[index]*2),(float)(-sFontHeight[index]*2));
>
> Removes both of these errors.  This is not the case on at least one other
> compiler I've tried.
>
> Why?

To cast (C style) you must put the type that you are going to in parenthesis.
I.e. From double to int:
    double d = 5.0;
    int i = (int)d;

I looked in a couple of books of mine to make sure I'm right, and I did see some
examples of something like int(d); but I've never been successful with that
method. Hopefully, soon egcs will support the ANSI Standard C++ methods of
typecasting:
e.g. Again, from int to float:
    double d = 5.0;
    int i = static_cast<int>d;

Anyone else?
--
=========================================================================

  Todd Warner <[EMAIL PROTECTED]> - http://pobox.com/~taw
  Computer geek at large... student at Wright State University... GNU/Linux
fanatic...
  GPG/PGP public key available at  http://pgp5.ai.mit.edu and other sites...
[GNU/Linux]
=========================================================================
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/H !d(d-) s: a- C++(++++) UL++(++++) P+ L+++ E W++ N ++(+) o K- w--- O(+) M?
V
PS++ PE Y+>++ PGP+/++>+++ t+ 5? X++ !R() tv b+>++++ DI+ D G>+++ e*>++ h-- r+ y+
------END GEEK CODE BLOCK------
http://www.geekcode.com

Reply via email to