1. version 4.03 gets() function warning
- Posted by BRyan Nov 05, 2011
- 1447 views
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
2. Re: version 4.03 gets() function warning
- Posted by ne1uno Nov 06, 2011
- 1328 views
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 translatedminGW 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()?
3. Re: version 4.03 gets() function warning
- Posted by ne1uno Nov 06, 2011
- 1357 views
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 translatedcorrecting 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.
4. Re: version 4.03 gets() function warning
- Posted by DerekParnell (admin) Nov 06, 2011
- 1351 views
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 translatedcorrecting 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.
5. Re: version 4.03 gets() function warning
- Posted by SDPringle Nov 07, 2011
- 1248 views
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