Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What the hell?
#1
By commenting blocks I got an error down to one sub call. So I tried using comment blocks to find the error in the sub. I ended up commenting the entire sub out and it still doesn't run. If I take out the sub call it works. THERE IS NO CODE IN THE SUB! What could cause something like this? If you want to see code I'll post it but I don't think it will matter.
f you play a Microsoft CD backwards you can hear demonic voices. The scary part is that if you play it forwards it installs Windows.
Reply
#2
Of course it will matter.

Post the code.

Also, what version are you using? The current testing release is .17.
Reply
#3
Nevermind, it was a bad pointer. I thought code wouldn't matter because I had commented everything out except for this part.

sub loadskin (s as skin ptr)
loadskin1(s->skin1)

and I forgot to allocate s. Don't you just hate when you spend two days trying to figure out what's wrong then it smacks you in the head?
f you play a Microsoft CD backwards you can hear demonic voices. The scary part is that if you play it forwards it installs Windows.
Reply
#4
New question: If I have a sub that allocates memory and I don't want it to allocate something twice (create an orphan,) can I deallocate first?

sub foo (s as sometype ptr)
deallocate s
s = allocate (len(sometype));
end sub

if I send it a blank pointer will the deallocate mess something up? It's basically doing the same as:

dim s as sometype ptr
deallocate s
f you play a Microsoft CD backwards you can hear demonic voices. The scary part is that if you play it forwards it installs Windows.
Reply
#5
deallocate( 0 ) does nothing, so your example will function normally.

if in doubt, try

Code:
if s then

  deallocate s

end if

"if s" breaks down to "if s <> 0"
Reply
#6
Cha0s, have you put me on ignore? Sad
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#7
You shouldn't free null pointers. You should also specify "ByRef" explicitly if that's what you want; otherwise, it's not clear to the reader, and it will break when you switch to -lang fb.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)