In these cases, designers can see the impact of changing the model's design features on the manufacturability of the final part.
In the document "Defining the Injection Mold for a Plastic Injection Molded Part," the author illustrates the process for designing and dimensioning an injection mold. The work takes a cross-sectional view of the mold cavity and uses data from the mold design program to generate a cost-efficient mold.Q:
Inline register value of a float variable
I have a float value say foo, in some function in the code
float foo = 10.0f;
void some_function(){
float x = foo;
float y = foo;
}
Now, when I am going to print x and y, both values are coming same.
Is there any way that I can get the value of register of foo, which stores the value of 10.0f
A:
Because x and y are the same memory location. It is a common mistake to think about the value of a floating point number as a value. In C, a float has no value. It is an object with attributes that describe it. Those attributes are used by the compiler to compute the value when the object is used.
A better example is that, in C, foo is an object with attributes like:
foo.type == float
foo.value == 10.0
foo.stored_in == the first general purpose register available to the compiler
Some compilers may be able to compute foo.value using foo.stored_in, but you have no guarantee. They may use a different general purpose register, or they may do a branch.
However, if you ask for a single access to that object, C doesn't care which register it is in, or even if it is a register at all. The compiler can read it from memory, or it can compute it from registers, or it can even implement it as a series of multiplication by 10, and an addition to the previous result, and do all sorts of things. But if you want to read the value from memory or compute it using a register, the compiler has no knowledge of that. So you have no way of knowing which register the compiler used, or even if it
Related links:
Comments