JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce_PlatformDefs.h File Reference
This graph shows which files directly or indirectly include this file:

Namespaces

 juce
 

Macros

#define DBG(textToWrite)   JUCE_BLOCK_WITH_FORCED_SEMICOLON (juce::String tempDbgBuf; tempDbgBuf << textToWrite; juce::Logger::outputDebugString (tempDbgBuf);)
 Writes a string to the standard error stream. More...
 
#define forcedinline   inline
 A platform-independent way of forcing an inline function. More...
 
#define jassert(expression)   JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)
 Platform-independent assertion macro. More...
 
#define jassertfalse   JUCE_BLOCK_WITH_FORCED_SEMICOLON (JUCE_LOG_CURRENT_ASSERTION; if (juce::juce_isRunningUnderDebugger()) JUCE_BREAK_IN_DEBUGGER; JUCE_ANALYZER_NORETURN)
 This will always cause an assertion failure. More...
 
#define jassertquiet(expression)   JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)
 Platform-independent assertion macro which suppresses ignored-variable warnings in all build modes. More...
 
#define JUCE_ALIGN(bytes)   __declspec (align (bytes))
 This can be placed before a stack or member variable declaration to tell the compiler to align it to the specified number of bytes. More...
 
#define JUCE_ANALYZER_NORETURN
 
#define JUCE_BLOCK_WITH_FORCED_SEMICOLON(x)   do { x } while (false)
 This is the good old C++ trick for creating a macro that forces the user to put a semicolon after it when they use it. More...
 
#define JUCE_BREAK_IN_DEBUGGER   { ::kill (0, SIGTRAP); }
 This will try to break into the debugger if the app is currently being debugged. More...
 
#define JUCE_CALLTYPE   __stdcall
 This macro defines the C calling convention used as the standard for JUCE calls. More...
 
#define JUCE_CDECL   __cdecl
 
#define JUCE_COMPILER_WARNING(message)   _Pragma(JUCE_STRINGIFY (JUCE_WARNING_HELPER (message)))
 This macro allows you to emit a custom compiler warning message. More...
 
#define JUCE_DECLARE_NON_COPYABLE(className)
 This is a shorthand macro for deleting a class's copy constructor and copy assignment operator. More...
 
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
 This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for a class. More...
 
#define JUCE_DECLARE_NON_MOVEABLE(className)
 This is a shorthand macro for deleting a class's move constructor and move assignment operator. More...
 
#define JUCE_FALLTHROUGH
 Used to silence Wimplicit-fallthrough on Clang and GCC where available as there are a few places in the codebase where we need to do this deliberately and want to ignore the warning. More...
 
#define JUCE_JOIN_MACRO(item1, item2)   JUCE_JOIN_MACRO_HELPER (item1, item2)
 A good old-fashioned C macro concatenation helper. More...
 
#define JUCE_LOG_CURRENT_ASSERTION   juce::logAssertion (__FILE__, __LINE__);
 
#define JUCE_NO_ASSOCIATIVE_MATH_OPTIMISATIONS   __attribute__((__optimize__("no-associative-math")))
 This can be appended to a function declaration to tell gcc to disable associative math optimisations which break some floating point algorithms. More...
 
#define JUCE_PACKED   __attribute__((packed))
 
#define JUCE_PREVENT_HEAP_ALLOCATION
 This macro can be added to class definitions to disable the use of new/delete to allocate the object on the heap, forcing it to only be used as a stack or member variable. More...
 
#define JUCE_STRINGIFY(item)   JUCE_STRINGIFY_MACRO_HELPER (item)
 A handy C macro for stringifying any symbol, rather than just a macro parameter. More...
 

Macro Definition Documentation

◆ DBG

#define DBG (   textToWrite)    JUCE_BLOCK_WITH_FORCED_SEMICOLON (juce::String tempDbgBuf; tempDbgBuf << textToWrite; juce::Logger::outputDebugString (tempDbgBuf);)

Writes a string to the standard error stream.

Note that as well as a single string, you can use this to write multiple items as a stream, e.g.

DBG ("foo = " << foo << "bar = " << bar);

The macro is only enabled in a debug build, so be careful not to use it with expressions that have important side-effects!

See also
Logger::outputDebugString

◆ forcedinline

#define forcedinline   inline

A platform-independent way of forcing an inline function.

Use the syntax:

forcedinline void myfunction (int x)

◆ jassert

#define jassert (   expression)    JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)

Platform-independent assertion macro.

This macro gets turned into a no-op when you're building with debugging turned off, so be careful that the expression you pass to it doesn't perform any actions that are vital for the correct behaviour of your program!

See also
jassertfalse

◆ jassertfalse

This will always cause an assertion failure.

It is only compiled in a debug build, (unless JUCE_LOG_ASSERTIONS is enabled for your build).

See also
jassert

◆ jassertquiet

#define jassertquiet (   expression)    JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)

Platform-independent assertion macro which suppresses ignored-variable warnings in all build modes.

You should probably use a plain jassert() by default, and only replace it with jassertquiet() once you've convinced yourself that any unused-variable warnings emitted by the compiler are harmless.

◆ JUCE_ALIGN

#define JUCE_ALIGN (   bytes)    __declspec (align (bytes))

This can be placed before a stack or member variable declaration to tell the compiler to align it to the specified number of bytes.

◆ JUCE_ANALYZER_NORETURN

#define JUCE_ANALYZER_NORETURN

◆ JUCE_BLOCK_WITH_FORCED_SEMICOLON

#define JUCE_BLOCK_WITH_FORCED_SEMICOLON (   x)    do { x } while (false)

This is the good old C++ trick for creating a macro that forces the user to put a semicolon after it when they use it.

◆ JUCE_BREAK_IN_DEBUGGER

#define JUCE_BREAK_IN_DEBUGGER   { ::kill (0, SIGTRAP); }

This will try to break into the debugger if the app is currently being debugged.

If called by an app that's not being debugged, the behaviour isn't defined - it may crash or not, depending on the platform.

See also
jassert()

◆ JUCE_CALLTYPE

#define JUCE_CALLTYPE   __stdcall

This macro defines the C calling convention used as the standard for JUCE calls.

◆ JUCE_CDECL

#define JUCE_CDECL   __cdecl

◆ JUCE_COMPILER_WARNING

#define JUCE_COMPILER_WARNING (   message)    _Pragma(JUCE_STRINGIFY (JUCE_WARNING_HELPER (message)))

This macro allows you to emit a custom compiler warning message.

Very handy for marking bits of code as "to-do" items, or for shaming code written by your co-workers in a way that's hard to ignore.

GCC and Clang provide the #warning directive, but MSVC doesn't, so this macro is a cross-compiler way to get the same functionality as #warning.

◆ JUCE_DECLARE_NON_COPYABLE

#define JUCE_DECLARE_NON_COPYABLE (   className)
Value:
className (const className&) = delete;\
className& operator= (const className&) = delete;

This is a shorthand macro for deleting a class's copy constructor and copy assignment operator.

For example, instead of

class MyClass
{
etc..
private:
MyClass (const MyClass&);
MyClass& operator= (const MyClass&);
};

..you can just write:

class MyClass
{
etc..
private:
};

◆ JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR

#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (   className)
Value:
JUCE_LEAK_DETECTOR(className)

This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for a class.

◆ JUCE_DECLARE_NON_MOVEABLE

#define JUCE_DECLARE_NON_MOVEABLE (   className)
Value:
className (className&&) = delete;\
className& operator= (className&&) = delete;

This is a shorthand macro for deleting a class's move constructor and move assignment operator.

◆ JUCE_FALLTHROUGH

#define JUCE_FALLTHROUGH

Used to silence Wimplicit-fallthrough on Clang and GCC where available as there are a few places in the codebase where we need to do this deliberately and want to ignore the warning.

◆ JUCE_JOIN_MACRO

#define JUCE_JOIN_MACRO (   item1,
  item2 
)    JUCE_JOIN_MACRO_HELPER (item1, item2)

A good old-fashioned C macro concatenation helper.

This combines two items (which may themselves be macros) into a single string, avoiding the pitfalls of the ## macro operator.

◆ JUCE_LOG_CURRENT_ASSERTION

#define JUCE_LOG_CURRENT_ASSERTION   juce::logAssertion (__FILE__, __LINE__);

◆ JUCE_NO_ASSOCIATIVE_MATH_OPTIMISATIONS

#define JUCE_NO_ASSOCIATIVE_MATH_OPTIMISATIONS   __attribute__((__optimize__("no-associative-math")))

This can be appended to a function declaration to tell gcc to disable associative math optimisations which break some floating point algorithms.

◆ JUCE_PACKED

#define JUCE_PACKED   __attribute__((packed))

◆ JUCE_PREVENT_HEAP_ALLOCATION

#define JUCE_PREVENT_HEAP_ALLOCATION
Value:
private: \
static void* operator new (size_t) = delete; \
static void operator delete (void*) = delete;

This macro can be added to class definitions to disable the use of new/delete to allocate the object on the heap, forcing it to only be used as a stack or member variable.

◆ JUCE_STRINGIFY

#define JUCE_STRINGIFY (   item)    JUCE_STRINGIFY_MACRO_HELPER (item)

A handy C macro for stringifying any symbol, rather than just a macro parameter.

juce::gl::x
GLdouble x
Definition: juce_gl.h:939
DBG
#define DBG(textToWrite)
Writes a string to the standard error stream.
Definition: juce_PlatformDefs.h:145
forcedinline
#define forcedinline
A platform-independent way of forcing an inline function.
Definition: juce_PlatformDefs.h:283
JUCE_DECLARE_NON_COPYABLE
#define JUCE_DECLARE_NON_COPYABLE(className)
This is a shorthand macro for deleting a class's copy constructor and copy assignment operator.
Definition: juce_PlatformDefs.h:230