I'll post the answer as the first reply so that the answer isn't visible on the main LAVA page.
Posted 25 April 2009 - 12:05 AM
Posted 25 April 2009 - 12:20 AM
Posted 25 April 2009 - 10:41 AM
I always like proving R&D wrong:A block diagram constant of a refnum type always has the value "Not A Refnum,"
Posted 25 April 2009 - 12:03 PM
I always like proving R&D wrong:
I'm posting the VI (8.0), but I suggest you try recreating this yourself first (it's not particularly hard).
As a more general point, what's the relevance of such a question to the CLD and how are users supposed to know the answer? I doubt this appears in the documentation.
Posted 25 April 2009 - 05:06 PM
Posted 25 April 2009 - 06:09 PM
Posted 26 April 2009 - 07:09 PM
Good catch. I botched question 2. I meant it as follows:
Posted 27 April 2009 - 08:17 PM
The constant's value is always zero. That's the key thing to realize -- if you change a control whose value is non-zero into a constant, for refnums, you always get zero.I fail to see the big difference between this and the original form of the question. In any case, you should note that the behavior I demonstrated only occurs until you close the VI. When you reopen it, the constant is equal to 0.
All this circumvents the main issue I and others brought up - should such a thing be asked, at any level of certification? I would say that this is both arcane and unreliable knowledge, as NI could change it, and doesn't have any real value, other than as a trivia question (which as we can see needs to be checked before it can be answered correctly). Ideally, any advanced developer should know to use the Not a... primitive, although I'll admit to using the type-cast-and-compare-to-0 method myself in production code in the past.
It better not be something that NI could change. That's equivalent -- to me -- of saying you can't rely on the behavior of the Add primitive because LV might decide to make it do subtraction. These behaviors are exactly the sort of behaviors that I consider "language" as opposed to "editor". Both the "what does the "not a" prim do" and the "what is the value of a refnum constant" ought to be things that a LV programmer can absolutely depend continuing to work in future LV versions. If a change were to occur, this is the sort of thing that (a) would require significant mutation code such that existing VIs continue to operate as they did before, (b) an change to the diagram drawing such that the new primitive or the non-zero refnum constant look substantively different from the existing prim or constant, © "save for previous" functionality, and probably (d) some way to continue to drop the previous functionality in the new LV version.
Posted 27 April 2009 - 09:14 PM
Well you can paste in a non-zero value, but it doesn't get saved. So I guess I agree. Still I would never depend on that.The constant's value is always zero. That's the key thing to realize -- if you change a control whose value is non-zero into a constant, for refnums, you always get zero.
It better not be something that NI could change.
I agree that the Not-a-Refnum primitive needs to be reliably the same between versions, but the internal format of the refnum is opaque, and I wouldn't depend on that. Any use of the typecast function to inspect internal formats is risky, and could be changed by NI without protest from me. Of course it's nice that it hasn't been changing a lot, but my code wouldn't depend a typecast anyway. In some decade it's entirely possible LV could go all 64-bit, and then I would expect typecasting a refnum to a U32 would probably break.
Posted 27 April 2009 - 10:10 PM
Well you can paste in a non-zero value, but it doesn't get saved.
I'd rather have a separate namespace for queues and notifiers, if you're trying to fix stuff.
I thought they do (not that I checked).