Issues with underscores in variable or procedure names

The basics of how to develop, test, and use models.
Post Reply
nikkip
Posts: 28
Joined: Mon Jun 24, 2013 6:09 pm

Issues with underscores in variable or procedure names

Post by nikkip »

Hi Ted,

I use underscores in almost all of my variable/procedure/function names. But I've just recently that sometimes these underscores make NEURON crash. For instance:

Code: Select all

proc batchrun() {
	print "testing 1"
}
batchrun()

proc batch_run() {
	print "testing 2"
}
batch_run()
The first procedure runs fine, but the second crashes. Is this because there is a hidden built-in variable or function called "_run" that's conflicting somehow? And if that's the case, is there a list of such key words that should be avoided in conjunction with variable/function/procedure names?

Thanks!

Nikki
nikkip
Posts: 28
Joined: Mon Jun 24, 2013 6:09 pm

Re: Issues with underscores in variable or procedure names

Post by nikkip »

Interesting... If you replace batch_run() with batch_gun(), it works fine. So some conflict with the built-in run() function?
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Issues with underscores in variable or procedure names

Post by ted »

batch_run() is a reserved name--look it up in the Programmer's Reference. Any attempt to redefine batch_run() should generate a syntax error message.
Post Reply