Hi
Right now I do multiple asserts to verify multiple values:
assert(foo==X);
assert(foo==Y);
assert(foo==Z);
Is there any way to macro-ize this and do it in one call?
MYASRT(foo, (X||Y||Z));
... or maybe...
MYASRT(foo,OR,X ,Y,Z));
TIA,
-T 23 1478
gamename wrote:
Hi
Right now I do multiple asserts to verify multiple values:
assert(foo==X);
assert(foo==Y);
assert(foo==Z);
Is there any way to macro-ize this and do it in one call?
MYASRT(foo, (X||Y||Z));
... or maybe...
MYASRT(foo,OR,X ,Y,Z));
What's wrong with:
assert(foo == X || foo == Y || foo == Z);
santosh wrote:
gamename wrote:
>Hi
Right now I do multiple asserts to verify multiple values: assert(foo==X) ; assert(foo==Y) ; assert(foo==Z) ;
Is there any way to macro-ize this and do it in one call? MYASRT(foo, (X||Y||Z)); ... or maybe... MYASRT(foo,OR, X,Y,Z));
What's wrong with:
assert(foo == X || foo == Y || foo == Z);
That is wrong!
Should be:
assert(foo == X && foo == Y && foo == Z);
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique http://www.cs.virginia.edu/~lcc-win32
jacob navia wrote:
santosh wrote:
>gamename wrote:
>>Hi
Right now I do multiple asserts to verify multiple values: assert(foo==X ); assert(foo==Y ); assert(foo==Z );
Is there any way to macro-ize this and do it in one call? MYASRT(foo, (X||Y||Z)); ... or maybe... MYASRT(foo,OR ,X,Y,Z));
What's wrong with:
assert(foo == X || foo == Y || foo == Z);
That is wrong!
Should be:
assert(foo == X && foo == Y && foo == Z);
Oops yes. You are right.
In my defence I got sidetracked by the "MYASRT" macro presented by the
OP, where he uses the OR operator, instead of the AND.
santosh wrote:
jacob navia wrote:
>santosh wrote:
>>gamename wrote:
Hi
Right now I do multiple asserts to verify multiple values: assert(foo== X); assert(foo== Y); assert(foo== Z);
Is there any way to macro-ize this and do it in one call? MYASRT(foo , (X||Y||Z)); ... or maybe... MYASRT(foo,O R,X,Y,Z)); What's wrong with:
assert(foo == X || foo == Y || foo == Z);
That is wrong! Should be:
assert(foo == X && foo == Y && foo == Z);
Oops yes. You are right.
In my defence I got sidetracked by the "MYASRT" macro presented by the
OP, where he uses the OR operator, instead of the AND.
Yes but now that I think about it...
How can foo be 3 different things at the same time as in the
original code???
>>>assert(foo== X); assert(foo== Y); assert(foo== Z);
That can't be right!
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique http://www.cs.virginia.edu/~lcc-win32
jacob navia wrote:
santosh wrote:
>jacob navia wrote:
>>santosh wrote: gamename wrote:
Hi > Right now I do multiple asserts to verify multiple values: assert(foo= =X); assert(foo= =Y); assert(foo= =Z); > Is there any way to macro-ize this and do it in one call? MYASRT(fo o, (X||Y||Z)); ... or maybe... MYASRT(foo, OR,X,Y,Z)); What's wrong with:
assert(foo == X || foo == Y || foo == Z);
That is wrong! Should be:
assert(foo == X && foo == Y && foo == Z);
Oops yes. You are right.
In my defence I got sidetracked by the "MYASRT" macro presented by the OP, where he uses the OR operator, instead of the AND.
Yes but now that I think about it...
How can foo be 3 different things at the same time as in the
original code???
>>>assert(foo== X);
>>>assert(foo== Y);
>>>assert(foo== Z);
That can't be right!
Yes. The sequence of assert invocations as presented seem redundant. Of
course some code could occur between the calls or the OP might have
just presented this as an example to enquire about writing complex
expressions with assert.
Yes. The sequence of assert invocations as presented seem redundant. Of
course some code could occur between the calls or the OP might have
just presented this as an example to enquire about writing complex
expressions with assert.
Correct. The example is simplified for that purpose.
santosh schrieb:
>How can foo be 3 different things at the same time as in the original code???
> >>>assert(foo== X); assert(foo== Y); assert(foo== Z);
That can't be right!
Yes. The sequence of assert invocations as presented seem redundant. Of
course some code could occur between the calls or the OP might have
just presented this as an example to enquire about writing complex
expressions with assert.
Maybe he wanted to something like this:
assert(foo==X== Y==Z);
/* ;) */
--
OMG,-10==10 in linux!
jacob navia wrote:
santosh wrote:
>jacob navia wrote:
.... snip ...
>>> assert(foo == X && foo == Y && foo == Z);
.... snip ...
>
Yes but now that I think about it...
How can foo be 3 different things at the same time as in the
original code???
>>>>assert(foo= =X); assert(foo= =Y); assert(foo= =Z);
That can't be right!
#define foo n++
#enum {X, Y, Z);
int n = 0;
Now it passes the assert :-)
--
Chuck F (cbfalconer at maineline dot net)
<http://cbfalconer.home .att.net>
Try the download section.
--
Posted via a free Usenet account from http://www.teranews.com
On Nov 28, 3:17 pm, jacob navia <ja...@nospam.c omwrote:
santosh wrote:
jacob navia wrote:
santosh wrote: gamename wrote:
>>Hi
>>Right now I do multiple asserts to verify multiple values: assert(foo==X ); assert(foo==Y ); assert(foo==Z );
>>Is there any way to macro-ize this and do it in one call? MYASRT(foo, (X||Y||Z)); ... or maybe... MYASRT(foo,OR ,X,Y,Z)); What's wrong with:
> assert(foo == X || foo == Y || foo == Z);
That is wrong!
Should be:
assert(foo == X && foo == Y && foo == Z);
Oops yes. You are right.
In my defence I got sidetracked by the "MYASRT" macro presented by the
OP, where he uses the OR operator, instead of the AND.
Yes but now that I think about it...
How can foo be 3 different things at the same time as in the
original code???
>>>assert(foo== X);
>>>assert(foo== Y);
>>>assert(foo== Z);
That can't be right!
Perhaps foo is a macro with side-effects?
>
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatiquehtt p://www.cs.virginia .edu/~lcc-win32
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Donald 'Paddy' McCarthy |
last post by:
So, for those that don't actively not-want a Python macro facility.
If we are to have it what should it do?
1) Macro definitions should allow Doc strings.
2) There should be a separate statement to import Macro definitions
from another file.
3) Existing import of a module file containing module definitions
should NOT cause the module files macros to be 'active' in the file
that is importing.
A new macro import command would be needed...
|
by: mike420 |
last post by:
I think everyone who used Python will agree that its syntax is
the best thing going for it. It is very readable and easy
for everyone to learn. But, Python does not a have very good
macro capabilities, unfortunately. I'd like to know if it may
be possible to add a powerful macro system to Python, while
keeping its amazing syntax, and if it could be possible to
add Pythonistic syntax to Lisp or Scheme, while keeping all
of the...
|
by: John |
last post by:
Please, consider this macro:
#define mymacro(arg1, arg2) arg1 and arg2
Then it is used:
mymacro(boys, girls)
How is its expansion?
|
by: Pete |
last post by:
In Access 95/97 I used to be able to create pull down menus (File,Edit
...) from a macro. It seems there used to be some wizard for that.
However in Access 2000 it seems you have to build your menus by
customizing a toolbar. With this method you have to create a separate
macro for every single menu and sub menu. The old method would allow
me to include several menus (File/ print/ page setup ...) all within
one macro. Now it seems I...
|
by: tmountjr |
last post by:
I've got a user who's trying to export a text file with unicode
formatting. When he exports it as straight ascii, some of the foreign
characters (mostly just accent marks and the like - no non-roman
characters that I can see) don't come through right. So he needs it in
Unicode formatting. He's using code for the DoCmd.OutputTo command.
There's a very undocumented Encoding option for that command, but no
options are specified and there's...
| |
by: Alexander Ulyanov |
last post by:
Hi all.
Is it possible to pass the whole blocks of code (possibly including
" and ,) as macro parameters?
I want to do something like:
MACRO(FOO, "Foo",
"return "Foobar";",
"foo(); bar();")
|
by: lasek |
last post by:
Hi...in some posts i've read...something about using macro rather then
function...but difference ??.
Best regards....
|
by: Takeadoe |
last post by:
Dear NG,
Can someone assist me with writing the little code that is needed to
run an update table query each time the database is opened? From what
I've been able to glean from this group, the Autoexec Macro looks like
the way to go. Could someone please assist?
Thank you very much!
Mike
|
by: Bill |
last post by:
This database has no forms. I am viewing an Access table in datasheet
view. I'd like to execute a macro to execute a function (using
"runcode"). In the function, I'll reading data from the record the
cursor was on in the datasheet at the time I executed the macro.
So, the questions are: 1) In the macro, how to I get my hands on the
record key or record data of the record the cursor was on in the
datasheet at the time I executed the...
|
by: Peng Yu |
last post by:
Hi,
It is benifitical to use macro in certain cases.
http://www.boost.org/doc/libs/1_35_0/libs/preprocessor/doc/index.html
However, I found that it is not easy to debug a macro. For example,
for the following program, I can not trace into the last macro in gdb.
In this sense, if I want to debug the code easily, should I avoid
|
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: 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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: 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();...
|
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: 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
|
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...
| |