Macros, parбmetros - Duda
#5

Vale, y ya esta ъltima duda a que se refiere con esto..

Quote:
Originally Posted by ******
Brackets

If the parameters are so flexible, how can you actually control what gets output? All the macros so far have been very bad - they didn't use brackets. Compare the following two macros:

Код:
// Without brackets (first).
#define MULTIPLY_TWO_A(%0,%1)           %0 * %1

// With brackets (second).
#define MULTIPLY_TWO_B(%0,%1)           ((%0) * (%1))

main()
{
    // Two with first.
    printf("%d", MULTIPLY_TWO_A(6, 7));
    
    // Two with second.
    printf("%d", MULTIPLY_TWO_B(6, 7));
    
    // Three with first.
    printf("%d", MULTIPLY_TWO_A(6, 7, 8));
    
    // Three with second.
    printf("%d", MULTIPLY_TWO_B(6, 7, 8));
}
Reply


Messages In This Thread
Macros, parбmetros - Duda - by GranaT3 - 03.12.2015, 00:31
Respuesta: Macros, parбmetros - Duda - by TheMasterNico - 03.12.2015, 01:19
Respuesta: Macros, parбmetros - Duda - by GranaT3 - 03.12.2015, 01:33
Respuesta: Macros, parбmetros - Duda - by TheMasterNico - 03.12.2015, 01:38
Respuesta: Macros, parбmetros - Duda - by GranaT3 - 03.12.2015, 01:44
Respuesta: Macros, parбmetros - Duda - by DesingMyCry - 03.12.2015, 02:24
Respuesta: Macros, parбmetros - Duda - by GranaT3 - 03.12.2015, 02:34
Respuesta: Macros, parбmetros - Duda - by DesingMyCry - 04.12.2015, 01:27

Forum Jump:


Users browsing this thread: 1 Guest(s)