1. version 4.03 gets() function warning

The following program can be used to demonstrate the problem

 
-- TEST.EXW ---------------------------------------------------------------- 
-- 
sequence in = {} 
puts(1,"\nEnter a short sequence like ' abcd ' : ") 
in = gets(0) 
puts(1,"\n") 
? in 
puts(1,"\nNote how the gets(0) returns the sequence ending with {13,10} or {10}\n"& 
       "\nNow translate this program with -wat or -gcc option and run it\n"& 
       "again to see how it ends") 
if getc(0) then end if 
-- 
-- END TEST.EXW ------------------------------------------------------------ 


In the past we have been using an interpreter built with Watcom
and Translating using Watcom.

If you DON'T use a WATCOM built interpreter and translate with the -wat option
the gets() function returns a DIFFERENT termination.

In other words if you write code to strip off 13,10 ending and translate with a different compiler
You will get different results than what you were expecting

Perhaps this may case strange problems like in TRACE code, or other code.

Also this will be problem with using older code not written for MinGW

new topic     » topic index » view message » categorize

2. Re: version 4.03 gets() function warning

BRyan said...

The following program can be used to demonstrate the problem

...

In other words if you write code to strip off 13,10 ending and translate with a different compiler
You will get different results than what you were expecting

I have no idea why. just confirming the difference.

 Enter a short sequence like ' abcd ' : abcd 
{97,98,99,100,10}  wat4.0 eui & euc translated 
{97,98,99,100,10}  wat4.1 
{97,98,99,100,13,10}  minGW 4.0  eui & euc  translated 
{97,98,99,100,10}  minGW 4.1  eui & euc  translated 
 
minGW gcc is 4.52

I didn't try the latest eubin cross compiled version.

when you translate, I believe the source created is the same -wat or -gcc using euc built with watcom or minGW, just the build system changes.

maybe there is a text/binary mode for get()?

new topic     » goto parent     » topic index » view message » categorize

3. Re: version 4.03 gets() function warning

 Enter a short sequence like ' abcd ' : abcd 
{97,98,99,100,10}  wat4.0 eui & euc translated 
{97,98,99,100,10}  wat4.1 
{97,98,99,100,13,10}  minGW 4.0  eui & euc  translated 
{97,98,99,100,13,10}  minGW 4.1  eui & euc  translated 
 
correcting test for minGW 4.1 is the same as 4.0.4 using recent sources.

eubind for all versions are the same as eui/euc.

new topic     » goto parent     » topic index » view message » categorize

4. Re: version 4.03 gets() function warning

ne1uno said...

 Enter a short sequence like ' abcd ' : abcd 
{97,98,99,100,10}  wat4.0 eui & euc translated 
{97,98,99,100,10}  wat4.1 
{97,98,99,100,13,10}  minGW 4.0  eui & euc  translated 
{97,98,99,100,13,10}  minGW 4.1  eui & euc  translated 
 
correcting test for minGW 4.1 is the same as 4.0.4 using recent sources.

eubind for all versions are the same as eui/euc.

This looks like a mistake. As far as know, lines returned by gets() should always be terminated with a LF and not a CR-LF sequence, regardless of the platform or compiler used.

new topic     » goto parent     » topic index » view message » categorize

5. Re: version 4.03 gets() function warning

DerekParnell said...

This looks like a mistake. As far as know, lines returned by gets() should always be terminated with a LF and not a CR-LF sequence, regardless of the platform or compiler used.

This issue could be caused by a program reopening standard input as binary. Ming might be doing this before main is called.

Shawn Pringle

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu