Recent

Author Topic: How do i shrink the length of a string variable ?  (Read 2940 times)

rvk

  • Hero Member
  • *****
  • Posts: 6716
Re: How do i shrink the length of a string variable ?
« Reply #15 on: August 23, 2023, 04:20:38 pm »
@KodeZwerg: as @rvk wrote such functions already exist, what is the purpose of duplicating them?

Without SysUtils in a very size saving way

On a AVR ? Or is the example above for ARM?
The example is for Free Pascal (unit sysutils in particular as that includes the helpers) . But in case you are memory restricted then using sysutils is not the smartest idea because of its size.

But TS is very unclear with his questions and use-case.

paweld

  • Hero Member
  • *****
  • Posts: 1367
Re: How do i shrink the length of a string variable ?
« Reply #16 on: August 23, 2023, 04:24:27 pm »
@rvk: thanks   
   
@KodeZwerg: Sorry, I didn't read.
Best regards / Pozdrawiam
paweld

TRon

  • Hero Member
  • *****
  • Posts: 4360
Re: How do i shrink the length of a string variable ?
« Reply #17 on: August 23, 2023, 04:28:07 pm »
But TS is very unclear with his questions and use-case.
And without wanting to assault/discredit TS but that seems to be his way of doing. Usually we never get an answer to these kind of questions that are important to know for being able to provide an answer that is correct or better suited for the situation.

It is not a problem per se but very annoying and leaves us in the dark not knowing the circumstances therefor also not knowing if the provided answers were correct for the situation (other then the occasional, "it works now, thank you").

All I know is that AVR as well as ARM can be restricted as it depends on specific HW details. Other than that I can't find a valid reason (as stated before by others ) to not use unit sysutils.
Today is tomorrow's yesterday.

Thaddy

  • Hero Member
  • *****
  • Posts: 16940
  • Ceterum censeo Trump esse delendam
Re: How do i shrink the length of a string variable ?
« Reply #18 on: August 24, 2023, 09:01:02 am »
All I know is that AVR as well as ARM can be restricted as it depends on specific HW details. Other than that I can't find a valid reason (as stated before by others ) to not use unit sysutils.
That is true and that also means that there is a valid reason to provide refactored versions of sysutils since it has grown so big, too big for some HW. For arm-embedded I have a stripped down version available, but I hesitate to publish it, since Ialready gave it to some forum members, one of whom did not understand that more than a few calls are necessary left out: IOW then you have a support problem for beginners and intermediates.

I also object to declaring a string as plain "string". That depends on {$H+/-} and other compiler directives, like {$mode delphiunicode}. Specify your string type to avoid misinterpretation, e.g: shortstring, ansistring, unicodestring are all valid "string". If you don't know what you are doing that can be the cause of many errors.
In general, on resource starved platforms one should use ShortString.
« Last Edit: August 24, 2023, 09:37:03 am by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

 

TinyPortal © 2005-2018