Dorian Yates
Dorian Yates

Reputation: 149

_THROW not defined in GCC?

Please tell me where the _THROW macro is defined in GCC4 or how to define it manually

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include <climits>
#include <stdexcept>
#include <sys/cdefs.h>
#include <sys/types.h>

void test() { _THROW(std::range_error,"Test"); }

Upvotes: 0

Views: 468

Answers (1)

orlp
orlp

Reputation: 117771

If you want to throw an exception in C++, use the standard C++ throw keyword:

 throw std::range_error("Test"); 

Please refrain from using some compiler-specific internal macro.


If you must define it, here you go:

#define _THROW(e, ...) throw e(__VA_ARGS__)

Upvotes: 3

Related Questions