Re: An illuminating experiment using platform().

new topic     » goto parent     » topic index » view thread      » older message » newer message
Jeremy Cowgar said...
Shawn Pringle B.Sc. said...

There is absolutely no branching cost of using platform() rather than ifdef when translating to C.

Which is exactly what I do right now, I have pgsql.e, mysql.e and sqlite.e that expose the identical interface, thus, I have a Euphoria app that can run any db I want. The possibilities are endless if ifdef and platform() has no advantage over ifdef. Oh, and in case you are thinking shrouded apps, I think we have a way that ifdef will work just fine in shrouded apps as well.

So, why use platform()? I have no clue.

Jeremy

For cross compilation purposes.

I'm on a Windows platflrom, and wish to output code that might run under Unix. An ifdef WIN32 statement will indeed cut off any Unix specific code, and the code won't ever show up in generated IL.

The easiest way out is to distribute ckear source code, so that it is ILed on the same machine where it will run. Perhaps some licensing agreement about using some third party code will prevent that. Or perhaps your app is payware, so there must be some copy protection.

platform() is obviously less versatile than ifdef. But it is the only currently known way to defer cutting code off whie having parsed it already, and still distribute only one file. Cross-translating is fine, but then you must distribute as ùmany executables as psupported platforms.

If we had a deferred_ifdef, then platform() could be deprecated.

CChris

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu