Author Topic: De Rigueur INKEY ? NOT !  (Read 280 times)

Robert

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
De Rigueur INKEY ? NOT !
« on: June 27, 2020, 04:15:51 PM »
BCX 7.4.6, line 15367, Pelles C 10.0 is warning

Quote
Operands of '<=' have types with different signedness: 'int' and 'unsigned long long int'.

Consider changing BCX 7.4.6 line 15314 from

Code: [Select]
FPRINT FP_WRITE,"  int i = 0;"
to

Code: [Select]
FPRINT FP_WRITE,"  size_t i = 0;"

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 538
    • View Profile
Re: De Rigueur INKEY ? NOT !
« Reply #1 on: June 27, 2020, 04:54:21 PM »
Robert ... I've made the change that you suggested.

I keep Pelles' warning level at 1 which produces no warnings on 7.4.7

If I raise the warning level to 2, I get all of these which makes me wonder
why you focused on only the Inkey warning?


Code: [Select]
bc.c(557): warning #2248: Use of the optional argument extension is not portable.
bc.c(560): warning #2248: Use of the optional argument extension is not portable.
bc.c(562): warning #2248: Use of the optional argument extension is not portable.
bc.c(569): warning #2248: Use of the optional argument extension is not portable.
bc.c(570): warning #2248: Use of the optional argument extension is not portable.
bc.c(571): warning #2248: Use of the optional argument extension is not portable.
bc.c(576): warning #2248: Use of the optional argument extension is not portable.
bc.c(577): warning #2248: Use of the optional argument extension is not portable.
bc.c(581): warning #2248: Use of the optional argument extension is not portable.
bc.c(585): warning #2248: Use of the optional argument extension is not portable.
bc.c(590): warning #2248: Use of the optional argument extension is not portable.
bc.c(600): warning #2248: Use of the optional argument extension is not portable.
bc.c(602): warning #2248: Use of the optional argument extension is not portable.
bc.c(603): warning #2248: Use of the optional argument extension is not portable.
bc.c(605): warning #2248: Use of the optional argument extension is not portable.
bc.c(606): warning #2248: Use of the optional argument extension is not portable.
bc.c(613): warning #2248: Use of the optional argument extension is not portable.
bc.c(614): warning #2248: Use of the optional argument extension is not portable.
bc.c(615): warning #2248: Use of the optional argument extension is not portable.
bc.c(1488): warning #2248: Use of the optional argument extension is not portable.
bc.c(1508): warning #2248: Use of the optional argument extension is not portable.
bc.c(1509): warning #2248: Use of the optional argument extension is not portable.
bc.c(1510): warning #2248: Use of the optional argument extension is not portable.
bc.c(1587): warning #2248: Use of the optional argument extension is not portable.
bc.c(1641): warning #2248: Use of the optional argument extension is not portable.
bc.c(1648): warning #2248: Use of the optional argument extension is not portable.
bc.c(1651): warning #2248: Use of the optional argument extension is not portable.
bc.c(3418): warning #2215: Conversion from 'int' to 'char'; possible loss of data or unexpected result.
bc.c(3419): warning #2215: Conversion from 'int' to 'char'; possible loss of data or unexpected result.
bc.c(3420): warning #2215: Conversion from 'int' to 'char'; possible loss of data or unexpected result.
bc.c(3421): warning #2215: Conversion from 'int' to 'char'; possible loss of data or unexpected result.
bc.c(3422): warning #2215: Conversion from 'int' to 'char'; possible loss of data or unexpected result.
bc.c(3423): warning #2215: Conversion from 'int' to 'char'; possible loss of data or unexpected result.
bc.c(3424): warning #2215: Conversion from 'int' to 'char'; possible loss of data or unexpected result.
bc.c(3425): warning #2215: Conversion from 'int' to 'char'; possible loss of data or unexpected result.
bc.c(3426): warning #2215: Conversion from 'int' to 'char'; possible loss of data or unexpected result.
bc.c(3427): warning #2215: Conversion from 'int' to 'char'; possible loss of data or unexpected result.
bc.c(3440): warning #2215: Conversion from 'int' to 'char'; possible loss of data or unexpected result.
bc.c(3596): warning #2215: Conversion from 'int' to 'unsigned char'; possible loss of data or unexpected result.
bc.c(3710): warning #2215: Conversion from 'int' to 'short int'; possible loss of data or unexpected result.
bc.c(3711): warning #2215: Conversion from 'int' to 'short int'; possible loss of data or unexpected result.
bc.c(3732): warning #2215: Conversion from 'int' to 'unsigned short int'; possible loss of data or unexpected result.
bc.c(3798): warning #2805: Possible violation of strict-aliasing rules.
bc.c(3811): warning #2805: Possible violation of strict-aliasing rules.
bc.c(3826): warning #2805: Possible violation of strict-aliasing rules.
bc.c(3790): warning #2810: Potential memory leak on failure: x = realloc(x, ...).
bc.c(3809): warning #2810: Potential memory leak on failure: x = realloc(x, ...).
bc.c(3864): warning #2805: Possible violation of strict-aliasing rules.
bc.c(3865): warning #2805: Possible violation of strict-aliasing rules.
bc.c(3872): warning #2250: Declaration of 'FP1' is shadowing previous declaration at bc.c(1299).
bc.c(3909): warning #2215: Conversion from 'int' to 'short int'; possible loss of data or unexpected result.
bc.c(3910): warning #2215: Conversion from 'int' to 'short int'; possible loss of data or unexpected result.
bc.c(3925): warning #2805: Possible violation of strict-aliasing rules.
bc.c(3926): warning #2215: Conversion from 'int' to 'short int'; possible loss of data or unexpected result.
bc.c(3927): warning #2215: Conversion from 'int' to 'short int'; possible loss of data or unexpected result.
bc.c(3930): warning #2215: Conversion from 'int' to 'unsigned short int'; possible loss of data or unexpected result.
bc.c(3944): warning #2805: Possible violation of strict-aliasing rules.
bc.c(3947): warning #2215: Conversion from 'int' to 'short int'; possible loss of data or unexpected result.
bc.c(3948): warning #2215: Conversion from 'int' to 'short int'; possible loss of data or unexpected result.
bc.c(3949): warning #2215: Conversion from 'int' to 'unsigned short int'; possible loss of data or unexpected result.
bc.c(3968): warning #2118: Parameter 'lParam' is not referenced.
bc.c(3986): warning #2805: Possible violation of strict-aliasing rules.
bc.c(3987): warning #2805: Possible violation of strict-aliasing rules.
bc.c(4408): warning #2215: Conversion from 'double' to 'int'; possible loss of data or unexpected result.
bc.c(4780): warning #2215: Conversion from 'double' to 'float'; possible loss of data or unexpected result.
bc.c(4842): warning #2250: Declaration of 'Src' is shadowing previous declaration at bc.c(1279).
bc.c(4999): warning #2250: Declaration of 'szTmp' is shadowing previous declaration at bc.c(1278).
bc.c(6839): warning #2250: Declaration of 'DimType' is shadowing previous declaration at bc.c(1370).
bc.c(7570): warning #2250: Declaration of 'Z' is shadowing previous declaration at bc.c(1403).
bc.c(7767): warning #2250: Declaration of 'Z' is shadowing previous declaration at bc.c(1403).
bc.c(9004): warning #2250: Declaration of 'Z' is shadowing previous declaration at bc.c(1403).
bc.c(9005): warning #2250: Declaration of 'FP1' is shadowing previous declaration at bc.c(1299).
bc.c(9184): warning #2250: Declaration of 'szTmp' is shadowing previous declaration at bc.c(1278).
bc.c(9231): warning #2250: Declaration of 'i' is shadowing previous declaration at bc.c(9159).
bc.c(9232): warning #2250: Declaration of 'j' is shadowing previous declaration at bc.c(9158).
bc.c(9648): warning #2250: Declaration of 'i' is shadowing previous declaration at bc.c(9159).
bc.c(9939): warning #2215: Conversion from 'unsigned char' to 'double'; possible loss of data or unexpected result.
bc.c(10899): warning #2250: Declaration of 'i' is shadowing previous declaration at bc.c(9705).
bc.c(11074): warning #2250: Declaration of 'i' is shadowing previous declaration at bc.c(9705).
bc.c(11421): warning #2250: Declaration of 'i' is shadowing previous declaration at bc.c(9705).
bc.c(11672): warning #2250: Declaration of 'i' is shadowing previous declaration at bc.c(9705).
bc.c(12269): warning #2250: Declaration of 'i' is shadowing previous declaration at bc.c(9705).
bc.c(13072): warning #2250: Declaration of 'i' is shadowing previous declaration at bc.c(9705).
bc.c(13620): warning #2250: Declaration of 'i' is shadowing previous declaration at bc.c(13596).
bc.c(14095): warning #2250: Declaration of 'i' is shadowing previous declaration at bc.c(14027).
bc.c(14352): warning #2250: Declaration of 'j' is shadowing previous declaration at bc.c(14028).
bc.c(14466): warning #2215: Conversion from 'double' to 'int'; possible loss of data or unexpected result.
bc.c(14727): warning #2250: Declaration of 'szTmp' is shadowing previous declaration at bc.c(1278).
bc.c(15421): warning #2215: Conversion from 'double' to 'int'; possible loss of data or unexpected result.
bc.c(15427): warning #2215: Conversion from 'double' to 'int'; possible loss of data or unexpected result.
bc.c(15431): warning #2215: Conversion from 'double' to 'int'; possible loss of data or unexpected result.
bc.c(15476): warning #2250: Declaration of 'szWrk' is shadowing previous declaration at bc.c(15410).
bc.c(15834): warning #2250: Declaration of 'Z' is shadowing previous declaration at bc.c(1403).
bc.c(16054): warning #2250: Declaration of 'Src' is shadowing previous declaration at bc.c(1279).
bc.c(16179): warning #2250: Declaration of 'Z' is shadowing previous declaration at bc.c(1403).
bc.c(16190): warning #2250: Declaration of 'Z' is shadowing previous declaration at bc.c(1403).
bc.c(16320): warning #2250: Declaration of 'Z' is shadowing previous declaration at bc.c(1403).
bc.c(16355): warning #2250: Declaration of 'Z' is shadowing previous declaration at bc.c(1403).
bc.c(16356): warning #2250: Declaration of 'FP_R' is shadowing previous declaration at bc.c(1312).
bc.c(16386): warning #2250: Declaration of 'Z' is shadowing previous declaration at bc.c(1403).
bc.c(16387): warning #2250: Declaration of 'FP_R' is shadowing previous declaration at bc.c(1312).
bc.c(16425): warning #2250: Declaration of 'Z' is shadowing previous declaration at bc.c(1403).
bc.c(16426): warning #2250: Declaration of 'FP_R' is shadowing previous declaration at bc.c(1312).
bc.c(16464): warning #2250: Declaration of 'Z' is shadowing previous declaration at bc.c(1403).
bc.c(16465): warning #2250: Declaration of 'FP_R' is shadowing previous declaration at bc.c(1312).
bc.c(16495): warning #2250: Declaration of 'Z' is shadowing previous declaration at bc.c(1403).
bc.c(16496): warning #2250: Declaration of 'FP_R' is shadowing previous declaration at bc.c(1312).
bc.c(16532): warning #2250: Declaration of 'Z' is shadowing previous declaration at bc.c(1403).
bc.c(16533): warning #2250: Declaration of 'FP_DAT' is shadowing previous declaration at bc.c(1289).
bc.c(16592): warning #2250: Declaration of 'i' is shadowing previous declaration at bc.c(16569).
bc.c(17115): warning #2118: Parameter 'szWhere' is not referenced.
bc.c(19109): warning #2250: Declaration of 'Z' is shadowing previous declaration at bc.c(1403).
bc.c(19110): warning #2250: Declaration of 'FP_DAT' is shadowing previous declaration at bc.c(1289).
bc.c(30474): warning #2118: Parameter 'FP_WRITE' is not referenced.
bc.c(30479): warning #2118: Parameter 'FP_WRITE' is not referenced.
bc.c(30484): warning #2118: Parameter 'FP_WRITE' is not referenced.
bc.c(30912): warning #2215: Conversion from 'unsigned int' to 'double'; possible loss of data or unexpected result.
bc.c(30930): warning #2215: Conversion from 'unsigned int' to 'double'; possible loss of data or unexpected result.
bc.c(33154): warning #2215: Conversion from 'double' to 'int'; possible loss of data or unexpected result.
bc.c(33169): warning #2215: Conversion from 'double' to 'int'; possible loss of data or unexpected result.
bc.c(33520): warning #2250: Declaration of 'j' is shadowing previous declaration at bc.c(33343).
bc.c(33558): warning #2250: Declaration of 'j' is shadowing previous declaration at bc.c(33343).
bc.c(34104): warning #2250: Declaration of 'Var' is shadowing previous declaration at bc.c(1402).
bc.c(34295): warning #2250: Declaration of 'szTmp' is shadowing previous declaration at bc.c(1278).
bc.c(34383): warning #2215: Conversion from 'unsigned char' to 'double'; possible loss of data or unexpected result.
bc.c(35321): warning #2118: Parameter 'FuncRetnFlag' is not referenced.
bc.c(35330): warning #2118: Parameter 'Lookup' is not referenced.
bc.c(35479): warning #2250: Declaration of 'Comma' is shadowing previous declaration at bc.c(834).
bc.c(35639): warning #2215: Conversion from 'double' to 'int'; possible loss of data or unexpected result.
bc.c(35648): warning #2215: Conversion from 'double' to 'int'; possible loss of data or unexpected result.
bc.c(35387): warning #2118: Parameter 'FuncRetnFlag' is not referenced.
bc.c(35659): warning #2118: Parameter 'FuncRetnFlag' is not referenced.
bc.c(35919): warning #2118: Parameter 'FuncRetnFlag' is not referenced.
bc.c(35999): warning #2250: Declaration of 'Handle' is shadowing previous declaration at bc.c(1376).
bc.c(36000): warning #2250: Declaration of 'Var' is shadowing previous declaration at bc.c(1402).
bc.c(37966): warning #2250: Declaration of 'szTmp' is shadowing previous declaration at bc.c(1278).
bc.c(38007): warning #2250: Declaration of 'DimType' is shadowing previous declaration at bc.c(1370).
bc.c(37997): warning #2118: Parameter 'FuncRetnFlag' is not referenced.
bc.c(38632): warning #2250: Declaration of 'i' is shadowing previous declaration at bc.c(38623).
bc.c(38886): warning #2250: Declaration of 'DimType' is shadowing previous declaration at bc.c(1370).
bc.c(39416): warning #2250: Declaration of 'szTmp' is shadowing previous declaration at bc.c(1278).
bc.c(39515): warning #2250: Declaration of 'szTmp' is shadowing previous declaration at bc.c(1278).
bc.c(39625): warning #2250: Declaration of 'Comma' is shadowing previous declaration at bc.c(834).
bc.c(39658): warning #2250: Declaration of 'szTmp' is shadowing previous declaration at bc.c(1278).
bc.c(40113): warning #2118: Parameter 'FuncRetnFlag' is not referenced.
bc.c(40395): warning #2215: Conversion from 'double' to 'int'; possible loss of data or unexpected result.
bc.c(40399): warning #2215: Conversion from 'double' to 'int'; possible loss of data or unexpected result.
bc.c(40403): warning #2215: Conversion from 'double' to 'int'; possible loss of data or unexpected result.
bc.c(40420): warning #2250: Declaration of 'Funcname' is shadowing previous declaration at bc.c(1375).
bc.c(41521): warning #2118: Parameter 'szWord' is not referenced.
bc.c(41529): warning #2118: Parameter 'szWord' is not referenced.
bc.c(41598): warning #2118: Parameter 'szWord' is not referenced.
bc.c(41624): warning #2118: Parameter 'szWord' is not referenced.
bc.c(41643): warning #2118: Parameter 'szWord' is not referenced.
bc.c(41658): warning #2118: Parameter 'szWord' is not referenced.
bc.c(41745): warning #2118: Parameter 'szWord' is not referenced.
bc.c(41804): warning #2118: Parameter 'szWord' is not referenced.
bc.c(41838): warning #2118: Parameter 'szWord' is not referenced.
bc.c(41846): warning #2118: Parameter 'szWord' is not referenced.
bc.c(41855): warning #2118: Parameter 'iFLAG' is not referenced.
bc.c(41855): warning #2118: Parameter 'szWord' is not referenced.
bc.c(41870): warning #2118: Parameter 'szWord' is not referenced.
bc.c(41879): warning #2118: Parameter 'szWord' is not referenced.
bc.c(41917): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42040): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42059): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42067): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42075): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42104): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42154): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42162): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42175): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42186): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42195): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42203): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42211): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42219): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42229): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42237): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42245): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42261): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42274): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42323): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42337): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42385): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42393): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42401): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42411): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42419): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42427): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42435): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42448): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42462): warning #2215: Conversion from 'double' to 'int'; possible loss of data or unexpected result.
bc.c(42456): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42477): warning #2118: Parameter 'szWord' is not referenced.
bc.c(42489): warning #2215: Conversion from 'unsigned int' to 'double'; possible loss of data or unexpected result.
bc.c(42489): warning #2215: Conversion from 'double' to 'int'; possible loss of data or unexpected result.


Robert

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
Re: De Rigueur INKEY ? NOT !
« Reply #2 on: June 27, 2020, 05:24:18 PM »
Robert ... I've made the change that you suggested.

I keep Pelles' warning level at 1 which produces no warnings on 7.4.7

If I raise the warning level to 2, I get all of these which makes me wonder
why you focused on only the Inkey warning?


Hi MrBCX:

I wasn't focused on it. I just noticed it when I was checking the examples.

There are probably more instances of where int could be changed to size_t but as you said in an earlier post about warnings, IIRC, meh... 

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 538
    • View Profile
Re: De Rigueur INKEY ? NOT !
« Reply #3 on: June 27, 2020, 08:09:55 PM »
Quote from: Robert

Hi MrBCX:

I wasn't focused on it. I just noticed it when I was checking the examples.

There are probably more instances of where int could be changed to size_t but as you said in an earlier post about warnings, IIRC, meh...

Gotcha ... I forgot that you mentioned you were testing and capturing code output for the help file.

On the subject of replacing "int" with "size_t" in other parts of BCX, that will require a good amount of scrutiny, as "int" is signed and "size_t" is unsigned.

In the meantime, slow and steady is my game plan. 

After a few minor tweaks to the LccWin32 includes, BCX 7.4.7 again compiles and executes on par with Pelle's using a x86 target.  Having 5 compilers (LccWin32, Pelles, MSVC, Mingw and Clang) that I can use that correctly compile BCX 7.4.7 in 32 and 64 bit modes gives me confidence that BCX is functioning well.

jcfuller

  • Full Member
  • ***
  • Posts: 167
    • View Profile
Re: De Rigueur INKEY ? NOT !
« Reply #4 on: June 28, 2020, 09:58:37 AM »
Quote
After a few minor tweaks to the LccWin32 includes, BCX 7.4.7 again compiles and executes on par with Pelle's using a x86 target.  Having 5 compilers (LccWin32, Pelles, MSVC, Mingw and Clang) that I can use that correctly compile BCX 7.4.7 in 32 and 64 bit modes gives me confidence that BCX is functioning well.

Kevin,
  Do you use different BCX source versions for compiling the BCX.c and BCX.cpp to  32/64?
I was always paranoid on the switch to 64bit with bc9 so it was/is still 32bit. I am also compiling BCppX with MSVC as a 32bit c++ app. While everything may compile I was not sure it would produce the correct translations in all situations?

Did you download and install clang from here: https://releases.llvm.org/download.html

Would you share your batch files for compiling BCX.bas with the different compilers?

Thank you,
  James


MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 538
    • View Profile
Re: De Rigueur INKEY ? NOT !
« Reply #5 on: June 28, 2020, 11:47:39 AM »
JC,

Q) Do you use different BCX source versions for compiling the BCX.c and BCX.cpp to  32/64?
A) The only compiler that gets the .cpp treatment & extension is MSVC
I use G++ and CLANG++ to compile BC.C

Q) While everything may compile I was not sure it would produce the correct translations in all situations?
A) I cannot exhaustively test every version of BCX, compiled with all the different compilers,
for reasons that have more to do with resource files, libraries, COM and so on, than with the compilers themselves.


Q) Did you download and install clang from here: https://releases.llvm.org/download.html
A) Yes

Q) Would you share your batch files for compiling BCX.bas with the different compilers?
A) No, because that seems unnecessary to me.  I will share my CLANG batch files below.
Only works with 7.4.7 at this time, which I have not released yet. (Patience please)
The compile will fail if you try 7.4.6.


Performance wise, BCX compiled as 64-bit (Clang) and 64-bit (MSVC), both with full optimization
are effectively equal -- that is to say, both translate BC.BAS in ~0.8 seconds on my system.
The G++ version is a little slower and Pelles a tad slower than G++. 


Compile BC.BAS to 32 bit

Code: [Select]
bc bc
clang++ bc.c bc.res -o bc.exe  -m32 -Wno-everything -fms-extensions -fms-compatibility -Ofast

bc bc
clang++ bc.c bc.res -o bc.exe  -m32 -Wno-everything -fms-extensions -fms-compatibility -Ofast

bc bc
clang++ bc.c bc.res -o bc.exe  -m32 -Wno-everything -fms-extensions -fms-compatibility -Ofast





Compile BC.BAS to 64 bit

Code: [Select]
bc bc
clang++ bc.c bc.res -o bc.exe  -m64 -Wno-everything -fms-extensions -fms-compatibility -Ofast

bc bc
clang++ bc.c bc.res -o bc.exe  -m64 -Wno-everything -fms-extensions -fms-compatibility -Ofast

bc bc
clang++ bc.c bc.res -o bc.exe  -m64 -Wno-everything -fms-extensions -fms-compatibility -Ofast


« Last Edit: June 28, 2020, 01:42:26 PM by MrBcx »