I came across this code which does something I've never seen before.
Could
someone explain what the variable declaration between the function
header
and the function body do? Or at least point me in a direction to find
out
for myself. Again, I know what the code does, but I don't know what
the line
marked with <==== does.
Thanks,
Grant
int timeval_subtract (result, x, y)
struct timeval *result, *x, *y; <==== What does this do???
{
/* Perform the carry for the later subtraction by updating y. */
if (x->tv_usec < y->tv_usec) {
int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
y->tv_usec -= 1000000 * nsec;
y->tv_sec += nsec;
}
if (x->tv_usec - y->tv_usec 1000000) {
int nsec = (y->tv_usec - x->tv_usec) / 1000000;
y->tv_usec += 1000000 * nsec;
y->tv_sec -= nsec;
}
/* Compute the time remaining to wait.
tv_usec is certainly positive. */
result->tv_sec = x->tv_sec - y->tv_sec;
result->tv_usec = x->tv_usec - y->tv_usec;
/* Return 1 if result is negative. */
return x->tv_sec < y->tv_sec;
} 2 1713 gk****@gmail.com wrote:
I came across this code which does something I've never seen before.
Could
someone explain what the variable declaration between the function
header
and the function body do? Or at least point me in a direction to find
out
for myself. Again, I know what the code does, but I don't know what
the line
marked with <==== does.
Thanks,
Grant
int timeval_subtract (result, x, y)
struct timeval *result, *x, *y; <==== What does this do???
This is old K&R style code, from the days before C89.
--
Ian Collins.
On Feb 10, 6:40 pm, Ian Collins <ian-n...@hotmail.comwrote:
gke...@gmail.com wrote:
I came across this code which does something I've never seen before.
Could
someone explain what the variable declaration between the function
header
and the function body do? Or at least point me in a direction to find
out
for myself. Again, I know what the code does, but I don't know what
the line
marked with <==== does.
Thanks,
Grant
int timeval_subtract (result, x, y)
struct timeval *result, *x, *y; <==== What does this do???
This is old K&R style code, from the days before C89.
--
Ian Collins.
Thanks. I found this page which also helped: http://en.wikipedia.org/wiki/C89#ANSI_C_and_ISO_C This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: rick |
last post by:
Noob problem. I prefer to keep all my scripts in an external '.js' file.
I am currently loading the external '.js' file from the header. Problem is I
would like to declare
a global variable in the...
|
by: Michael |
last post by:
Hi newsgroup,
as the subject indicates I am looking for an advice
using global variables. I am not if this problem is more
about style then C. If its wrong in thi group, sorry.
So I have a...
|
by: martin |
last post by:
Hi,
I am a web page and a web user control. My web user control is placed in my
web page using the following directive
<%@ Register TagPrefix="uc1" TagName="Header"...
|
by: jethro_uk |
last post by:
Hi there,
I have a bizarre problem with FORM variables in ASP.
Scenario using VI6, IE6, Windows2000 server:
MyPage.ASP:
..
..
..
|
by: Aarchaic |
last post by:
Hello i have problem my session variables seem to disapear as i go along i've created this code to ilustrate whats happening
First off i just post 3 detials like a name a age and a favourite...
|
by: phoenix917 |
last post by:
I have been working on this code for 5 days... I have read multiple tutorials and looked at various code. This is my third forum try... :) My instructor refuses to help me. I think it's because...
|
by: weaknessforcats |
last post by:
C++: The Case Against Global Variables
Summary
This article explores the negative ramifications of using global variables. The use of global variables is such a problem that C++ architects have...
|
by: Ramon |
last post by:
Is there a way to initialize the variables (or other data) of a header
file by using a function (similar to main() function)??
Thankx
|
by: nathanwb |
last post by:
I have the following php code, at the top I am pulling a piece of data from a query and I echo the results with no problem, I am using Ajax with this page as well and further down the page when I...
|
by: Juha Nieminen |
last post by:
As we know, the keyword "inline" is a bit misleading because its
meaning has changed in practice. In most modern compilers it has
completely lost its meaning of "a hint for the compiler to inline...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |