The istructions like "&IF DEFINE(PIPPO) = 0 &TH

Posted by Admin on 11-Jun-2008 10:33

... example:

&IF DEFINE(PIPPO) = 0 &THEN

DEF SHARED VAR g-ses-id AS CHAR NO-UNDO.

&ENDIF

All Replies

Posted by Matt Baker on 11-Jun-2008 10:40

Posted by Tim Kuehn on 11-Jun-2008 12:35

In this example the g-ses-id variable

will only be included if the PIPPO preprocessor has

been previously defined.

Correction: In this example the g-ses-id variable will only be included if the PIPPO preprocessor has NOT been previously defined.

This is used as a "sentinel" conditional to prevent code from being included in a particular program file more than once.

Posted by Matt Baker on 11-Jun-2008 21:17

Tim is right. Thanks for the correction.

Posted by Admin on 12-Jun-2008 02:30

OK, tnx.

1]

I'm a dummie of the programmation, but what is with precision a "preprocessor expression"?

2]

Pippo in this example is a "preprocessor expression"?

Message was edited by:

matrixbob

Posted by Admin on 13-Jun-2008 08:13

Hi there,

As you mentioned you come from a C background. Preprocessor = Precompile statements

/* In Progress you do this */

&SCOPED-DEFINE PIPPO

&IF DEFINED( PIPPO ) &THEN

....

&ENDIF

/* In C you do this */

#define PIPPO

#ifdef PIPPO

....

#endif

Unfortunately Progress does not support C's macro functions (oh boy that would be nice to have ). On the other side, Progress has a wider range of Functions (ENTRY, LOOKUP,etc) as C.

Note that Progress implements two types of "defines" GLOBAL-DEFINE and SCOPED-DEFINE. Check the on-line help.

HTH

Posted by Tim Kuehn on 14-Jun-2008 09:47

Unfortunately

Progress does not support C's macro functions (oh boy

that would be nice to have

However, they're moving the language to an increasingly C++ form...

This thread is closed