03-17-2013 12:13 AM
Hello,
I was trying the sample exam at http://download.ni.com/pub/devzone/epd/clad_sample_exam2.pdf . Question 21 asks,
Which of the following statements is true regarding the use of Coercion Dots?
a. Coercion Dots improve program performance.
b. Coercion Dots represent a conversion from one data type to another.
c. Coercion Dots increases memory usage
d. Both A. and B.
e. Both B. and C.
I thought the answer is (b), but the given solution is (e).
Is (c) always true? I would've thought that coercing an integer to an enum would be inconsequential, from a code execution point of view.
Furthermore, I found an experiment at http://labviewartisan.blogspot.com.au/2012/08/whats-deal-with-coercion-dots.html which suggests that coercion dots are more memory-efficient than any manual conversion (at least in the tested case)
03-17-2013 01:59 AM
The CLAD sample questions are considered by many people to be problematic and sometimes downright wrong. I'm pretty sure that you're right and that a memory allocation is not required (for example, if you convert a typedef of a U32 to a U32 I expect you won't get a new allocation, but I can't say for sure. Personally, I think that such a question does not have a place in the CLAD exam because of these issues and because memory allocation is in implementation detail, but if you want to be successful in the exam, you will probably want to learn what kind of answers NI expects. In this case, I'm assuming that there reason for having the question there was so that CLADs will be aware that a coercion means a type conversion, which could often mean lost data and memory allocations. I would suggest doing a search to find out some of the other times when people had problems with the questions.
03-17-2013 04:55 AM
Hi,
Check this.
In the sixth point, they have mentioned about the coersion dots which states that when LabVIEW changes datatypes, the output is a new buffer.
Kudos always welcome
Gogineni
CLAD
03-17-2013 06:03 AM - edited 03-17-2013 06:05 AM
@Gogineni wrote:
In the sixth point, they have mentioned about the coersion dots which states that when LabVIEW changes datatypes, the output is a new buffer.
My question was what happens when there's a coercion dot, but the underlying data type is the same.
For example, if I single step through this and look at the memory monitor, it looks like I see one allocation at the init array function (8MB for the 1M element array) and another one at the end where the data goes into the indicator. The memory usage for the VI also says we're using 16MB, which would support the same two allocations. That means that there is no additional allocation at the coercion in the subVI:
The subVI is inlined and only passes the DBL input to the DBL output. It's only there to force the typedef to coerce to DBL.
I don't know if this says for certain that there's no allocation when the underlying type is the same (although I would think that it suggests that there isn't), but frankly, I don't really care either.
03-17-2013 07:14 PM
@tst wrote:
but if you want to be successful in the exam, you will probably want to learn what kind of answers NI expects. In this case, I'm assuming that there reason for having the question there was so that CLADs will be aware that a coercion means a type conversion, which could often mean lost data and memory allocations. I would suggest doing a search to find out some of the other times when people had problems with the questions.
Think like NI, eh? That's street smart 🙂 Thanks for the tip!