Macro without string to substitute

C

Casanova

Hello!!!

I have been using C for a very short while. I am used to macros in C,
but while i was reading the code for LittleOS (an open source OS), i
came across a type of macro wherein no value was given to substitute
the text. What does this imply? The code i came across is as follows:

#ifndef _TIME_H
#define _TIME_H

struct time {
int sec, min, hour;
};

struct date {
int dayofweek, day, month, year;
};

void gettime(struct time*);
void getdate(struct date*);
#endif


what does this do? Please Help

Casanova...
 
M

MarcSmith

i believe that what he asked for.

struct date dt;
getdate(&dt); // get current date into structure
struct time tm;
gettime(&tm); // get current time into structure.

no joke


-
MarcSmit
 
M

MarcSmith

getdate actually uses cmos to read the date as well as gettime uses cmo
to read the time so in the sence it actually gets the current date an
current time into the appropriate structure. take a look at the sourc
code yourself i did. i must have looked at least 10 times before t
make sure before i answered the post. that is why i said no joke cuz i
is not a joke. i am sorry to put that done. i was trying to answer you
question honestly. the other person was answering it lol. sorry abou
that


-
MarcSmit
 
R

Richard Bos

[ Please do not snip all context when replying to a post. Snipping is
good, but do leave enough context for someone to figure out what
you're replying to, including relevant attribution lines. Thanks. ]
i believe that what he asked for.

I can't imagine how you come to that conclusion, since his question was
quite explicitly about "a type of macro wherein no value was given to
substitute the text", not about the function declarations at all.
struct date dt;
getdate(&dt); // get current date into structure
struct time tm;
gettime(&tm); // get current time into structure.

None of these lines is ISO C. I've no idea what they are, but they're
definitely not on-topic here.
(BTW, that also means that if there wasn't any provision for choosing a
conforming mode in the OP's headers, his implementation is not
conforming, since those identifiers are in the user's namespace.)

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top