[comp.sys.amiga] Bug in Lattice 5.0?

AXDRW%ALASKA.BITNET@cunyvm.cuny.edu (Don R. Withey) (11/26/88)

I found something interesting today while running an old project through
the new Lattice 5.0 compiler.

I have some definitions amounting to:

        AltColor = "\x9B0;33m"

When I use this say in {printf("%s\n", AltColor);} I get a warning:
"Warning 121: Hex constant too large for char (high bits will be lost)"

Is this a bug, or am I getting bitten by another difference due to ANSI?

Can anyone tell me how I can get around this with out resorting to:

        AltColor = "\x1B[0;33m"

  Thanks
        Don

P.S. This works fine with 4.01
----------------------------------------------------------------
Don R Withey                    BITNET: AXDRW@ALASKA.BITNET
University of Alaska            BIX:    dwithey
3211 U.A.A. Drive
Anchorage, Alaska  99508
907-786-1074 (work) 907-277-9063 (home) 907-274-6378 (other home)
-----------------------------------------------------------------
Any expressed opinion is my own and in no way represent those of my employer,
the University of Alaska.

toebes@sas.UUCP (John Toebes) (11/28/88)

In article <5668@louie.udel.EDU> AXDRW%ALASKA.BITNET@cunyvm.cuny.edu (Don R. Withey) writes:
>I found something interesting today while running an old project through
>the new Lattice 5.0 compiler.
>
>        AltColor = "\x9B0;33m"
>
>When I use this say in {printf("%s\n", AltColor);} I get a warning:
>"Warning 121: Hex constant too large for char (high bits will be lost)"
>Is this a bug, or am I getting bitten by another difference due to ANSI?
This is brought to you compliments of ANSI.  They state that any number of
hexadecimal digits may appear after the \x and that there is no terminator
sequence that you can use to stop it.  The alternative suggested for this
is:
        AltColor = "\x9B" "0;33m"
Or in a manner that is much more readable,
   #define CSI "\x9B"
        AltColor = CSI "0;33m"

You should note that even the message is there to catch the ANSI problem
althought it continues to work like the 4.01 compiler did UNLESS you
specify the ANSI (-ca) switch).
>Don R Withey                    BITNET: AXDRW@ALASKA.BITNET
/*---------------------All standard Disclaimers apply---------------------*/
/*----Working for but not officially representing SAS or Lattice Inc.-----*/
/*----John A. Toebes, VIII             usenet:...!mcnc!rti!sas!toebes-----*/
/*------------------------------------------------------------------------*/

dillon@POSTGRES.BERKELEY.EDU (Matt Dillon) (11/29/88)

:>I found something interesting today while running an old project through
:>the new Lattice 5.0 compiler.
:>        AltColor = "\x9B0;33m"
:        AltColor = "\x9B" "0;33m"
:Or in a manner that is much more readable,
:   #define CSI "\x9B"
:        AltColor = CSI "0;33m"

	Uh, just use the octal escape sequence please ... 3 chars max
so this will do nicely:

	"\2330;33m"

				-Matt