Friends,
Can any body suggest any link to a tutorial, which can cover
various concepts of using macro in a program? I have seen macros used
to over come the endiness problems, portability issues, generality
etc. But I don't understand how it is been done.
Thanks 3 1787
sathyashrayan wrote: Can any body suggest any link to a tutorial, which can cover various concepts of using macro in a program? I have seen macros used to over come the endiness problems, portability issues, generality etc. But I don't understand how it is been done.
Limit yourself to #define CONST for now. Macros don't really
solve any problems, they just encapsulate them.
Any time you see a complex macro it isn't doing anything you
couldn't do yourself by writing things out in full. If you don't
understand what the code is doing, you can't write a macro to
implement it. There is no magic, just text replacement.
--
Chuck F (cb********@yah oo.com) (cb********@wor ldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net> USE worldnet address!
CBFalconer <cb********@yah oo.com> wrote in message news:<40******* ********@yahoo. com>... sathyashrayan wrote: Can any body suggest any link to a tutorial, which can cover various concepts of using macro in a program? I have seen macros used to over come the endiness problems, portability issues, generality etc. But I don't understand how it is been done.
Limit yourself to #define CONST for now. Macros don't really solve any problems, they just encapsulate them.
Any time you see a complex macro it isn't doing anything you couldn't do yourself by writing things out in full. If you don't understand what the code is doing, you can't write a macro to implement it. There is no magic, just text replacement.
I think I am confusing with pre-defined const and macros such as
__FILE__, __TIME__ __DATE__ , etc with that of normal macro
definitions. Ain't I ?
I have come across several macro constants apart from those defined in
6.10.8 of the standard. Does each compiler has it's own macro constant
other than the standard. I hope this is not an OT.
Thanks for the replay
sathyashrayan <sa************ @yahoo.co.in> wrote: CBFalconer <cb********@yah oo.com> wrote in message news:<40******* ********@yahoo. com>... sathyashrayan wrote: > > Can any body suggest any link to a tutorial, which can cover > various concepts of using macro in a program? I have seen macros > used to over come the endiness problems, portability issues, > generality etc. But I don't understand how it is been done. Limit yourself to #define CONST for now. Macros don't really solve any problems, they just encapsulate them.
Any time you see a complex macro it isn't doing anything you couldn't do yourself by writing things out in full. If you don't understand what the code is doing, you can't write a macro to implement it. There is no magic, just text replacement.
I think I am confusing with pre-defined const and macros such as __FILE__, __TIME__ __DATE__ , etc with that of normal macro definitions. Ain't I ?
I can't tell whether you're confusing 'em, but you may try to actually
ask a question about what you don't understand, about these defines? I have come across several macro constants apart from those defined in 6.10.8 of the standard. Does each compiler has it's own macro constant other than the standard. I hope this is not an OT.
Implementations (i.e. compilers) may introduce other macro constants,
but they have to define those in 6.10.8. You'll need to consult the
compilers manual/documentation.
--
Z (Zo**********@d aimlerchrysler. com)
"LISP is worth learning for the profound enlightenment experience
you will have when you finally get it; that experience will make you
a better programmer for the rest of your days." -- Eric S. Raymond This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Chris Reedy |
last post by:
For everyone -
Apologies for the length of this message. If you don't want to look
at the long example, you can skip to the end of the message.
And for the Python gurus among you, if you can spare the time, I
would appreciate any comments (including words like evil and disgusting,
if you think they are applicable :-}) on the example here.
Kenny -
|
by: michele.simionato |
last post by:
Paul Rubin wrote:
> How about macros? Some pretty horrible things have been done in C
> programs with the C preprocessor. But there's a movememnt afloat to
> add hygienic macros to Python. Got any thoughts about that?
"Movement" seems quite an exaggeration. Maybe 2-3 people made some
experiments, but nobody within the core Python developers seems
to be willing to advocate the introduction of macros.
> Why should you care whether the...
|
by: Prakash |
last post by:
Hi,
We face problems uploading excel (with macros) documents using HTML
File Upload.
The file contents are corrupted while viewing the same. However, we
are able to upload excel (w/o. macros) documents successfully. Is
there anything we have to take care of, while handling uploads of
excel documents with macros?
Thanks in advance,
|
by: Sabyasachi Basu |
last post by:
While trying to port some stuff from Unix to Windows, I encountered a
strange behaviour of function macros with empty arguments. Here is a small
snippet which illustrates the problem:
#include <iostream>
#include <string>
using namespace std;
#define B(X, Y) Y
|
by: paddy |
last post by:
I keep digging through tut after tut and I find lots and lots of C++
logic, but I can't find any straight forward plain and simple info on
the whole linking and library process.
Can anyone recommend a good source to digest that covers what is going
on in this regard? I can get things to work with the 'monkey see'
technique but it is still all voodoo.
I need to understand things like, how make files work, how vc++6
project files work,...
| |
by: Reg |
last post by:
At present I'm running a number of macros with a schedular on my
computer to update and maintain databases within our network. All my
backends contain the tables that the macros update. But all the
backends are on servers that do not have access loaded on them. I
don't think it's possible to activate these macros from the servers
schedular without access being present. Is this true?
Thanks
Reg
|
by: Stephen Sprunk |
last post by:
On a project I'm working on, I ran across the following macros:
/* assume s is struct stream *, s->p is char, v is unit16_t or uint32_t */
#define in_uint16_le(s,v) { v = *((s)->p++); v += *((s)->p++) << 8; }
#define in_uint32_le(s,v) { in_uint16_le(s,v) \
v += *((s)->p++) << 16; v += *((s)->p++) << 24; }
I'm personally not fond of function-like macros and wanted to turn these
into static inline functions, but I'm having trouble doing...
|
by: dan_roman |
last post by:
Hi,
I developed a script with a nice interface in Tkinter that allows me to
edit some formulas and to generate an Excel worksheet with VBA macros
within it. The script runs perfectlly in Office 2000, but in Office
2003 crash at line: "wbc = workbook.VBProject.VBComponents.Add(1)"
Please help me :-(
the code of the module that crash is (only in Excel 2003, in 2000 not):
import os
|
by: copx |
last post by:
Is it true that C macros are unsafe when combined with side effects even if
they are "clean" e.g. could
foo_macro(++c);
execute "++c" multiple times even if foo_macro is "clean"? I have always
thought that "clean" macros (i.e. macros where all parameters are
surrounded by parentheses in the definition) do not have this problem...
I am wondering because I have just looked up putc() in a reference, and it
|
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...
|
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,...
| |
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,...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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...
| |