Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is argument evaluation?

Tags:

c

Herbert Schildt says:

In some situations, real function should be used in place of function-like-macro, for example: where code size is to be minimized or where an argument must not be evaluated more than once.

What does he mean by "an argument must not be evaluated more than once?"

like image 688
Noman Hanafi Avatar asked Mar 14 '16 16:03

Noman Hanafi


People also ask

What is evaluation of argument?

Evaluative arguments argue that something is good/bad, effective/ineffective, helpful/harmful, etc. They evaluate something based one of the follow three types of criteria: practical, aesthetic, ethical. They consider which set of criteria (practical, aesthetic, ethical) their audience is likely to be convinced by.

Why is argument evaluation important?

The ability to evaluate these arguments to determine their credibility involves analysis and critical thinking. However, by evaluating what you read, you will have a much better understanding of what the text is trying to say and whether you agree with it.

How do we evaluate an argument in ethics?

In order to determine whether an argument is valid or not, ask yourself: Supposing that the premises are or were true (whether they really are or not), must the conclusion be true? If the answer is yes, then the argument is valid. If the answer is no, then the argument is invalid.

What is an evaluative argument?

Understanding Evaluations Evaluative arguments rely on judgements and appraisals, often regarding quality or performance Informal evaluative arguments take place daily Examples: awards shows, beauty pageants, best- or worst-dressed celebrities, literary prizes, political opinion polls, elections

What are the two questions to ask when evaluating an argument?

EVALUATING ARGUMENTS. There are two questions to ask: 1. Does the conclusion follow from the premises? That is, is the argument valid? 2. Are the premises true (or at least justified)? Or, is the argument sound (or, at least, strong)? VALIDITY. In a valid argument, the conclusion follows from the premises.

How should I evaluate an argument in Module 4?

In Module 4 we look at different types of arguments and you will be given ample opportunity to practice your competence at evaluating different kinds of arguments. We should take the arguments that we evaluate seriously, present them in their strongest form, and subject them to careful and deep analysis and assessment.

What is the purpose of an argument?

An argument's purpose is to compela listener to believe the conclusion on the basis of the reasons given in support. To be a good argument, it must supply agreeable reasons that make the conclusion seem clearly true. Thus, a good argument guides reason, whether or not it appeals to emotion.


1 Answers

Let's take a macro to calculate the maximum of two values:

#define MAX(a, b) ((a) < (b) ? (a) : (b)) 

Then we use it like this:

int x = 5; int y = 10; int max = MAX(x++, y++); 

Then the macro is expanded to

int max = ((x++) < (y++) ? (x++) : (y++)); 

As you can see, the increment operation on either x or y will happen twice, not what would happen if you had a function where each argument you pass is evaluated only once.


Another important point is the use of parentheses in the macro. Let's take another simple macro:

#define MUL(a, b) a * b 

Now if you invoke the macro as

int sum = MUL(x + 3, y - 2); 

then the expansion becomes

int sum = x + 3 * y - 2; 

Which due to operator precedence is equal to

int sum = x + (3 * y) - 2; 

Often not quite what was expected, if one expects (x + 3) * (y - 2).

This problem is also "solved" by using functions.

like image 93
Some programmer dude Avatar answered Oct 05 '22 22:10

Some programmer dude