[Coco] Fwd: MW-C Cross compiler bug - Solved

Luis Antoniosi (CoCoDemus) retrocanada76 at gmail.com
Tue Mar 11 13:35:49 EDT 2014


yup there is no function prototyping here.

So 10L*80L does work as (long)10*80 too.

But they are a very bad idea as it will resolve it in run time not
compiling time.

On Tue, Mar 11, 2014 at 1:31 PM, James Jones <jejones3141 at gmail.com> wrote:
> Yes. 10 * 80 will end up an int. Remember that the MW C compiler for the
> CoCo predates ANSI (and even lacks bitfields). I suspect that you'll find
> that the actual parameters just undergo the "usual argument promotions",
> and that once the compiler is done generating code for func, it pops the
> local symbols, including formal parameters, from the symbol table and
> doesn't remember that func() wants a long.
>
> James
>
>
> On Sun, Mar 9, 2014 at 5:34 PM, Luis Antoniosi (CoCoDemus) <
> retrocanada76 at gmail.com> wrote:
>
>> ok found other bug. when you have long as parameters and you call a
>> function using a immediate:
>>
>> void func(x)
>> long x;
>> {
>> }
>>
>>
>> main()
>> {
>>  func(10*80);
>> }
>>
>> I think it's still pushing an int instead of a long. If you use a long var
>> as:
>>
>> long v;
>>  v= 10*80;
>> func(v);
>>
>> it seems to work.
>>
>>
>> On Sun, Mar 9, 2014 at 5:27 PM, Jamie Cho <silurian at icloud.com> wrote:
>> > Thanks for the link! I knew it worked for me before even though it was
>> apparently always illegal.
>> >
>> > On Mar 9, 2014, at 5:13 PM, Chris Osborn <fozztexx at fozztexx.com> wrote:
>> >
>> >>
>> >> On Mar 9, 2014, at 2:01 PM, Gene Heskett wrote:
>> >>
>> >>> Are you saying that both of my copies (original and the "ANSI C"
>> versions
>> >>> of the K&R books are wrong?
>> >>
>> >> Page 250 of my ANSI K&R 2nd Edition book says:
>> >>
>> >> void *memcpy(s,ct,n)          copy n characters from ct to s, and
>> return s.
>> >> void *memmove(s,ct,n) same as memcpy except that it works even if the
>> objects overlap.
>> >>
>> >> So yes, you're supposed to use memmove.
>> >>
>> >> The memcpy vs. memmove saga:
>> >>
>> >> http://www.win.tue.nl/~aeb/linux/misc/gcc-semibug.html
>> >>
>> >> --
>> >> Coco mailing list
>> >> Coco at maltedmedia.com
>> >> http://five.pairlist.net/mailman/listinfo/coco
>> >
>> >
>> > --
>> > Coco mailing list
>> > Coco at maltedmedia.com
>> > http://five.pairlist.net/mailman/listinfo/coco
>>
>>
>>
>> --
>> Long live the CoCo
>>
>> --
>> Coco mailing list
>> Coco at maltedmedia.com
>> http://five.pairlist.net/mailman/listinfo/coco
>>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco



-- 
Long live the CoCo



More information about the Coco mailing list