system call reboot and magic numbers [duplicate] - c

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Magic numbers of the Linux reboot() system call
I was asked this question in an interview
When using the Linux-specific reboot()
system call to reboot the system, the
second argument, magic2, must be
specified as one of a set of magic
numbers (e.g., LINUX_REBOOT_MAGIC2).
What is the significance of these
numbers?
What is the correct answer to the above question?

The significance of the allowed set of magic2 numbers is that, when expressed in hexadecimal, they represent dates-of-birth (specifically, of Linus Torvalds and his three children).
This really lowers the bar on silly interview questions!

Related

Handling decimals in C without float [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have a problem in C, I am not allowed to use floats as the microcontroller it will be flashed does not support that data type. Now all my integers are being rounded off as it should. How do I handle this case?
A short research indicates using bit wise operation such as left shift and right shift. I know what are these operations. But I do not know how to use these operations to achieve what I want.
Another possibility is the Q number format.
You will get some results if you google "Q number format" or some variations.
It is often used for some DSP related topics in C. Here another blog post that explains that number format and here is an example code implementation for q-numbers in C.
In general you can say that q-numbers represent a number between -1 and 1 without using floating point arithmetic.
Normally a microcontroller don't have a floating point unit, everything works with integers. But its up to you which unit you like for your integers.
For example:
100 could be 100 cm or 1,00 m
1000 could be 100,0 cm or 1,000 m and so on..
Please have a look at the description:
electronic.stackexchange

fortran function to find available file unit [duplicate]

This question already has answers here:
getting free unit number in fortran
(2 answers)
Closed 7 years ago.
I can write a FORTRAN function to find an available file unit, but I was certain there was already an intrinsic. But if there is, I can't find anything about it. Is there such a thing or am I dreaming?
UPDATE: Apologies for the duplicate. Did a search, but it didn't show up.
I guess, you are looking for newunit (available with F2008, shown at the bottom of that link in the Fortran Wiki).
Ups, has already been answered.
maybe you were thinking of inquire?

What does `register` do in GStreamer [duplicate]

This question already has answers here:
"register" keyword in C?
(19 answers)
Closed 8 years ago.
I was reading some gstreamer code and fell on this line
register int i;
Does anyone know what the register keyword does ?
Another SO question has already answered this.
Answer From Brian Knoblauch:
It's a hint to the compiler that the variable will be heavily used and
that you recommend it be kept in a processor register if possible.
Most modern compilers do that automatically, and are better at picking
them than us humans. :-)
So, essentially, it assures the programmer that the compiler will know that the variable will be utilized numerous times and to keep that variable in the CPU register. As stated in the other answer, most compilers do this automatically.

How do we normalize a pointer? [duplicate]

This question already has answers here:
what is meant by normalization in huge pointers
(3 answers)
Closed 9 years ago.
Actually i was studying about huge and far pointers.
I come to know huge pointers are by default in normalized form.
I want to know how can we normalize any pointer?
The huge pointer and far pointer are old concept which live in 16-bit
DOS time. You can search something about DOS programming for more
detail about them.
In 8086 programming (MS DOS), a far pointer is normalized if its offset part is between 0 and 15 (0xF).

How is the function "sin" realized? [duplicate]

This question already has answers here:
How does C compute sin() and other math functions?
(22 answers)
Closed 9 years ago.
Anybody can explain or show how is the function "sin" (or "sinf", "sinl") realized in C.
Intuition suggests that it should be somewhere in the math.h but I did not see anything there
There's a couple ways I can think of right off the bat:
Lookup tables
Approximation via Taylor series (which can be easily made accurate to a number of significant digits).

Resources