still concatation prob

Beta Testing discussion on mikroPascal.
Post Reply
Author
Message
piort
Posts: 1379
Joined: 28 Dec 2005 16:42
Location: Laval,Québec,Canada,Earth... :-)
Contact:

still concatation prob

#1 Post by piort » 09 Aug 2008 23:23

hi,

Code: Select all

AA := '20';
BB := '00'
str1 := AA + BB
lcd_out(1,1,str1) // display '35yj 35yj'
strcat(AA,str2)
strcat(BB,str2)
lcd_out(2,1,str2) // display '2000'
maybe is good time to fix this old bug ;-)

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

#2 Post by janni » 10 Aug 2008 02:25

More probable, I'm affraid, is return to messages from v5:
Adding strings is not allowed, use "strcat" procedure instead

piort
Posts: 1379
Joined: 28 Dec 2005 16:42
Location: Laval,Québec,Canada,Earth... :-)
Contact:

#3 Post by piort » 10 Aug 2008 12:38

hi janni,

maybe your right, but adding string is old timer pascal rule )))

I know MCU arent PC but now customer want more and more interaction with the product. Its look like the market go in 2 different direction...
1- small mcu ( 10f, 12f) for 'secret automation' so no interaction
2- the rest where customer want interaction...GLCD with touchscreen, wireless ethernet ( and other network) , and so and so ....

So no choice, we have to work more and more with string. Is why i like your stringlib and conversion lib, that save me time and code. Maybe im wrong, but now, for me, programming MCU are the same when i start to programming for DOS. GLCD are the same then the old black screen, the limitation in space and memory, the neccesity to try to optimize code and so... I remember, when i was at university, it was impossible to write a program using more then 64K... and that was for PC...(oups, that telling my age....lol) imagine now all what i can do with a 18f4620 ... LOLOLOL

All that to say one thing, maybe is time to ME to go foward and solve this 'limitation' ... samething about objet and inherence .... but that is another story LOLOLOL

have a nice day :wink:

krikitu
Posts: 66
Joined: 03 Aug 2008 15:40

#4 Post by krikitu » 10 Aug 2008 14:13

If the addition is not allowed, then may be a function working like strcat2(dest, src1, src2) could be used ?
Instead of setting variable "dest", the function would return the value ? Then it would be easy to use this function like a "+" :

Code: Select all

AA := '20';
BB := '00'
lcd_out(1,1,fstrcat2(AA,BB))    // would display '2000' 
Procedures with variable parameters need a var declaration, which could not be useful, and so could free up some memory.
In the case of the function, a var could be declared only if needed. In the previous code, no need for a var, for example.

What do you think ?



Edit: Piort, I think we have the same birthday... ;) I remember programming in Turbo Pascal on a 8086, which had the 64K code limitation... at least for .COM executables.

piort
Posts: 1379
Joined: 28 Dec 2005 16:42
Location: Laval,Québec,Canada,Earth... :-)
Contact:

#5 Post by piort » 10 Aug 2008 16:07

hi,

your solution look nice too... but function dont return string... i hit that wall too...

Code: Select all


var 
temp1 : string[4]; // global var

function test1(x:byte): string[4];
begin
// do something that result was a string[4];
end;

// main
begin
while true do
  begin
  temp1 := test1(1); 
  end;
end.

the compiler give the error
E-3 Identifier ')' was not declared
1- the error dont say too much and worst , dont say where is the real prob :shock:
2- just remplace the return type solve the compiler error... so that mean return cant be string :evil:

another limitation against string type :cry:

note: happy to be not alone remembering this time ;-)

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

#6 Post by janni » 11 Aug 2008 01:19

piort wrote:hi,note: happy to be not alone remembering this time ;-)
You're certainly not the only one :) .
but function dont return string...
Yes, indeed :cry: . (It should not be that hard to implement, as string parameters are passed only by address so the function result could also be a pointer/address).
So no choice, we have to work more and more with string.
I agree, but with all the effort that goes into new IDE and command line compiler development there is little hope we'll see string adding issue resolved in v8.3.

Post Reply

Return to “mikroPascal Beta Testing”