Recent

Author Topic: Nil value on assignment of '' ?  (Read 1366 times)

aducom

  • Full Member
  • ***
  • Posts: 155
    • http://www.aducom.com
Re: Nil value on assignment of '' ?
« Reply #15 on: February 28, 2024, 07:00:56 pm »
@Thaddy, sometimes, reproducing is hard. I expected to have some kind of compiler setting to be wrong. It was not my intention to get a bunch of rants here.

Thaddy

  • Hero Member
  • *****
  • Posts: 14636
  • Sensorship about opinions does not belong here.
Re: Nil value on assignment of '' ?
« Reply #16 on: February 28, 2024, 07:03:22 pm »
if you Access STRING - then the CompilerProc fpc_ansistr_assign will be involved:
No. Only for AnsiStrings. NOT for any other supported string type,
bitrate is always calculated like this:sample rate * bitdepth * number of channels.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9992
  • Debugger - SynEdit - and more
    • wiki
Re: Nil value on assignment of '' ?
« Reply #17 on: February 28, 2024, 07:35:31 pm »
Can you try to compile with NO optimization (Project options > Compilation and linking).

or alternatively put this in your code (right after the unit line)
Code: Pascal  [Select][+][-]
  1. unit my_unit;
  2. {$Optimization PEEPHOLE off}

There is a tiny chance that might help.


Also just to be sure => in your examples you have just one or two local vars => in your real code, is it about a local variable too? or maybe a field in an object "form1.mystring" ?

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1322
    • Lebeau Software
Re: Nil value on assignment of '' ? {closed}
« Reply #18 on: February 28, 2024, 11:44:03 pm »
The variable is not static, declaring it static fixed the issue for me. Lesson learned.

That just sounds like a band-aid, not a real solution.  I still stand by my earlier assessment that you were likely accessing the string via an invalid pointer.  But, without seeing the real code, anything that anyone says is just speculation.
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11532
  • FPC developer.
Re: Nil value on assignment of '' ? {closed}
« Reply #19 on: February 29, 2024, 10:58:33 am »
That just sounds like a band-aid, not a real solution.  I still stand by my earlier assessment that you were likely accessing the string via an invalid pointer.  But, without seeing the real code, anything that anyone says is just speculation.

Calling a method on something that isn't a proper instance of the class, yes, that is what I think also.

 

TinyPortal © 2005-2018