473,602 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What's the meaning of the macro 'OF'

#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif

void func OF( args );

I saw some C programs written like this. Why?
Feb 2 '08 #1
4 1901
StdNewer wrote:
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
Are you sure that wasn't define OF(args) (args)?
# else
# define OF(args) ()
# endif
#endif

void func OF( args );

I saw some C programs written like this. Why?
Very old (before 1989) compilers didn't have function prototypes.
Expand the macros and see what you get with and without STDC defined.

--
Ian Collins.
Feb 2 '08 #2
Ian Collins <ia******@hotma il.comwrites:
StdNewer wrote:
>#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args

Are you sure that wasn't define OF(args) (args)?
Probably not: then it would only work with 0- or 1-parameter
functions, because a 1-argument macro cannot be invoked with
multiple comma-separated arguments.
--
char a[]="\n .CJacehknorstu" ;int putchar(int);in t main(void){unsi gned long b[]
={0x67dffdff,0x 9aa9aa6a,0xa77f fda9,0x7da6aa6a ,0xa67f6aaa,0xa a9aa9f6,0x11f6} ,*p
=b,i=24;for(;p+ =!*p;*p/=4)switch(0[p]&3)case 0:{return 0;for(p--;i--;i--)case+
2:{i++;if(i)bre ak;else default:continu e;if(0)case 1:putchar(a[i&15]);break;}}}
Feb 2 '08 #3
On 2ÔÂ2ÈÕ, ÏÂÎç2ʱ42·Ö, Ian Collins <ian-n...@hotmail.co mwrote:
StdNewer wrote:
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args

Are you sure that wasn't define OF(args) (args)?
I see,thanks very much.
I wrote wrong in "void func OF(args)"; it should be: void func
OF((args));
But if "#define OF(args) ()",this function is vod fun(()).
two parentheses,rig ht?
why didn't he define "OF" as you do,and declare function as
func OF(),not func OF(())?

Feb 2 '08 #4
StdNewer wrote:
On 2ÔÂ2ÈÕ, ÏÂÎç2ʱ42·Ö, Ian Collins <ian-n...@hotmail.co mwrote:
>StdNewer wrote:
>>#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
Are you sure that wasn't define OF(args) (args)?

I see,thanks very much.
I wrote wrong in "void func OF(args)"; it should be: void func
OF((args));
But if "#define OF(args) ()",this function is vod fun(()).
two parentheses,rig ht?
why didn't he define "OF" as you do,and declare function as
func OF(),not func OF(())?
See Ben's reply.

--
Ian Collins.
Feb 2 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

220
18959
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have any preconceived ideas about it. I have noticed, however, that every programmer I talk to who's aware of Python is also talking about Ruby. So it seems that Ruby has the potential to compete with and displace Python. I'm curious on what basis it...
23
7697
by: herrcho | last post by:
What's the difference between STDIN and Keyboard buffer ? when i get char through scanf, i type in some characters and press enter, then, where do the characters go ? to STDIN or Keyboard buffer ? are they same ? thanks ^^
9
28675
by: Qiao Jian | last post by:
I am new to c. Today I just read an h file within which there is statements: #ifndef _RANDOM_H #define _RANDOM_H So what is the meaning or purpose of this statement? When should I use such statement in my own program? Thank you so much!
4
1911
by: Garry Freemyer | last post by:
I'm trying to convert this macro to a c# function but I have a big problem. It's on the LEFT side of an assignment statement and I am extremely flustered over this one because I'm a little rusty and have been struggling over this for days, not wanting to show all my ignorance in final desparate plea for help which this is ... Here is the macro ... #define X(t,b) (sp->x)
22
28963
by: nick | last post by:
i do not know what is the use of (e.g. void *pt), when will use it. thanks!
16
10364
by: Abhishek | last post by:
why do I see that in most C programs, pointers in functions are accepted as: int func(int i,(void *)p) where p is a pointer or an address which is passed from the place where it is called. what do you mean by pointing to a void and why is it done? Aso, what happens when we typecast a pointer to another type. say for example int *i=(char *)p; under different situations? I am kind of confused..can anybody clear this confusion by clearly...
17
2038
by: zhangyue.zl | last post by:
static void (DEVICE_REQUEST)(void); What does this line declare in C? I am always meeting some codes like this,but I have never learnt that before. It looks like a declaration of a function,but why DEVICE_REQUEST has to be quoted by ( ). Anyone can explain that to me? thanks a lot!
10
48312
by: Thierry Lam | last post by:
What does the following macro mean, especially the << sign: #define hello(x) (( int64 ) floor( (double) x ) << 32) Thanks Thierry
1
2158
by: DaVinci | last post by:
I had thinked about the implements of variable argument for a long time. But I only know a little about it on the following macro. Could you please explain it for me? more detail.Thanks very much. typedef char *va_list; 275 #endif /* _VALIST */ 276 277 /*
6
2120
by: raghu | last post by:
Hello This is raghu. And I want to know about the meaning of the statement given below log_txt( __FILE__, __LINE__, ##argList); in above statement what does FILE ,LINE ##argList mean. I want to know about is it possiable to send arguments like that. Thanking you in advance
0
7993
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7920
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8054
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8268
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5867
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5440
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3944
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2418
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1254
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.