Refinement of DevCPP.GetCode

Re: Refinement of DevCPP.GetCode

Postby Zorko » Mon May 14, 2018 12:45 pm

I tested this code, and it works fine on all my tests that I used.
With the exception of one moment! Empty strings are still allowed. Do you see any practical meaning in this?

Code: Select all
PROCEDURE {code} Proc1"", "", "", 9,  "", "" ; (* <= now it compiles! *)

I'm sure that empty strings should not be allowed in a body of a code procedure either.
Zorko
 
Posts: 11
Joined: Tue Sep 17, 2013 10:13 pm
Location: Ukraine

Re: Refinement of DevCPP.GetCode

Postby luowy » Thu May 17, 2018 4:34 am

it can be corrected by add a condition which check the length of the string.
luowy
 
Posts: 27
Joined: Thu Dec 17, 2015 1:32 pm

Re: Refinement of DevCPP.GetCode

Postby Josef Templ » Fri May 18, 2018 3:17 pm

# empty string:
Why should we add any code for testing such an exotic case?
And why should it be considered wrong at the first place?

- Josef
Josef Templ
 
Posts: 211
Joined: Tue Sep 17, 2013 6:50 am

Re: Refinement of DevCPP.GetCode

Postby luowy » Tue May 22, 2018 12:20 pm

Josef Templ wrote:# empty string:
Why should we add any code for testing such an exotic case?
And why should it be considered wrong at the first place?

- Josef

the empty string produce nothing,
not like accept nonsense code in the source, no need follow the syntax of empty "WITH" clause .

luowy
luowy
 
Posts: 27
Joined: Thu Dec 17, 2015 1:32 pm

Re: Refinement of DevCPP.GetCode

Postby Zorko » Tue May 29, 2018 9:00 pm

I agree with Wening Luo.

A string in [code] procedures in general has very specific application, and a big programmer's accuracy is necessary here. Therefore it is good when a translator will warn of a meaningless design.
Zorko
 
Posts: 11
Joined: Tue Sep 17, 2013 10:13 pm
Location: Ukraine

Re: Refinement of DevCPP.GetCode

Postby Josef Templ » Wed May 30, 2018 6:43 am

My understanding is that strings in GetCode are mainly supported because once there was a version of BlackBox that
translated to C code and code procedures were strings of C code.
For the i386 native code compiler you would not use strings for code procedures.

- Josef
Josef Templ
 
Posts: 211
Joined: Tue Sep 17, 2013 6:50 am

Re: Refinement of DevCPP.GetCode

Postby luowy » Wed May 30, 2018 7:22 am

Josef Templ wrote:My understanding is that strings in GetCode are mainly supported because once there was a version of BlackBox that
translated to C code and code procedures were strings of C code.
For the i386 native code compiler you would not use strings for code procedures.

- Josef

we need only forbidden empty string, it's meaningless in the code.
luowy
 
Posts: 27
Joined: Thu Dec 17, 2015 1:32 pm

Re: Refinement of DevCPP.GetCode

Postby Josef Templ » Wed May 30, 2018 2:12 pm

> we need only forbidden empty string, it's meaningless in the code.

It has a well-defined meaning and it does not cause any problems and it is not used at all.
Therefore I strongly believe that it is not worth extra code for checking it and it is not worth extra docu for defining it to be illegal.
You can even construct (theoretical) cases where it may be convenient,
for example if you generate a C code procedure line by line from some source text.
Then you don't have to check for this special case.

- Josef
Josef Templ
 
Posts: 211
Joined: Tue Sep 17, 2013 6:50 am

Re: Refinement of DevCPP.GetCode

Postby luowy » Wed May 30, 2018 4:17 pm

luowy wrote:It has a well-defined meaning and it does not cause any problems and it is not used at all.
Therefore I strongly believe that it is not worth extra code for checking it and it is not worth extra docu for defining it to be illega

I think these empty strings useless and make source code dirty,hard to read;
Code: Select all
PROCEDURE {code} Proc1"", "", "", 9,  "", "" ;

it should be
Code: Select all
PROCEDURE {code} Proc1  9;

the check is very cheap:
Code: Select all
.... 
ELSIF (cx.typ.form = String8)&(cx.conval.intval2 >1)THEN
....


You can even construct (theoretical) cases where it may be convenient,
for example if you generate a C code procedure line by line from some source text.
Then you don't have to check for this special case.

I know you are maintaining the Ofront at same time, I have no experience about it, you choice may be good for it;
let's stop this discussion;
luowy
 
Posts: 27
Joined: Thu Dec 17, 2015 1:32 pm

Previous

Return to Bug

Who is online

Users browsing this forum: No registered users and 0 guests

cron