platform() and FREEBSD

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

In 3.x platform() returned 3 for both Linux and FreeBSD, however, there are major differences between the two platforms. In almost all cases in 4.x it's better to use ifdef, but some places still use platform(). In those cases, platform now returns 8 for FreeBSD. It use to return 3. The constant FREEBSD has been updated to reflect this change, so checks such as:

if platform() = FREEBSD then 

will still work. However, checks like this:

if platform() = LINUX then 
    -- We are on UNIX 
end if 

will no longer work (even prior to this change, since we have added OSX, OpenBSD, NetBSD and SunOS). To check if your application is running on UNIX, use this:

ifdef UNIX then 

or, the old method, which is not guaranteed to work in the future:

if platform() >= LINUX then 

The reason it may not work in the future is because FREEBSD is now defined as 8. It's possible that we may add on a new operating system, say OS2 (for some silly reason), then OS2 would be 9 which is not UNIX.

Jeremy

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

Search



Quick Links

User menu

Not signed in.

Misc Menu