Googles appar
Huvudmeny

Post a Comment On: cbloom rants

"07-18-11 - cblib Relacy"

5 Comments -

1 – 5 of 5
Anonymous Anonymous said...

How portable is '#define $ foo'? That seems a crazy choice to me, but I guess you were limited by Relacy compatibility.

July 18, 2011 at 3:14 PM

Blogger cbloom said...

So far as a I know it's portable; it's always a bit dangerous using such a short identifier, if anyone else had the crazy idea of using $ then you have conflict problems.

But anything longer would make the syntax unbearable.

The $ has to be a #define to get FILE and LINE (which Relacy uses to make the debug trace nice). Otherwise the scheduler struct could be inserted with a class shim.

My stuff should still work fine without the $'s , you just won't get the reschedule points. So they can be removed for production code.

July 18, 2011 at 3:21 PM

Blogger ryg said...

That's not what Sean means (I think); "$" is not actually in the supported input character set for C identifiers, nor in the set required to be supported by the preprocessor. The preprocessor is allowed to support $ (and most do), but this is an extension. See e.g. here.

July 18, 2011 at 6:07 PM

Blogger cbloom said...

Sometimes "so far as I know" doesn't go very far...

July 18, 2011 at 6:49 PM

Blogger cbloom said...

You can actually use Relacy without the $

He has a macro VAR so instead of

xx($) you do

VAR(xx)

but I like the look of the code much better with the $.

July 20, 2011 at 1:53 PM

You can use some HTML tags, such as <b>, <i>, <a>

This blog does not allow anonymous comments.

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.