c++


Macro to define custom exception type - Bad Practice


Is using a c macro like the below to define an exception bad practice?
#define CUSTOM_EXCEPTION(name, msg) class name : std::exception { \
virtual const char* what() const throw() { \
return #msg; \
} \
};
I kind of like the idea of using a macro, because DRY, but I've heard bad things about using macros making code unmaintainable. Is there a better way to define a simple type macro returning a custom message?

Related Links

cplusplus.com used as reference [closed]
C++ function templates
How to parse a date string into a c++11 std::chrono time_point or similar?
0xC0000005: Access violation reading location 0x00000000 hashfunc [closed]
Objects modified when they are passed to a function as arguments in C++
How to send message FROM Chrome extension TO Native app?
Qt: distinguish between drag from same or other window
Dynamically allocated string array, then change it's value?
Efficiency in a C++ function?
using nested std::array to create an multidimensional array without knowing dimensions or extents until runtime
How to create a C/C++ Library and Put them into Xcode for iOS?
Applying some filter on my accelerometer data - Windows phone 8, C++
distribute a number of zeros anywhere in a grid
VDS (Virtual Disk Service) COM interface notifications - callback (sink) invoked only during unregister (Unadvise)
SQL Server and OLE DB Consumer: pointer to IUnknown interface of a Rowset Object
Assign values based on variable name in a string

Categories

HOME
audio
github
dll
automation
authorization
logistic-regression
get
amazon-redshift
houndify
ais
axis2
vaadin-grid
pygtk
openmeetings
directive
widget
spring-aop
sql-azure
affinity
azure-storage-blobs
cider
qtspim
deprecation-warning
bug-tracking
angle
formsets
size-classes
biblatex
radius
spring-4
ipc
tail-recursion
responsive-filemanager
rrd4j
leanft
oracle-ebs
marytts
ifttt
smo
family-tree
safe-browsing
ikvm
heyzap
android-gson
prime-factoring
google-keep
sonarqube-4.5
express-stormpath
aide-ide
windows-firewall-api
syncsort-dmx-h
htsql
nested-function
smf
correspondence-analysis
django-class-based-views
payara
jedit
busy-waiting
objdump
ti-nspire
wordpress-4.5
bitarray
django-pipeline
xamarin-forms
protractor-net
bpopup
amdatu
qmediaplayer
ncbi
topological-sort
sapb1
image-manipulation
httplib
orca
tbb
code-metrics
jsqlparser
runscope
nools
restriction
objectarx
declarative-services
android-x86
buttonclick
interlacing
django-1.2
inference
tiles2
mat-file
emacs-semantic
fold
cvxopt
jnetpcap
iwebkit
dotfuscator
incompatibletypeerror
wind-river-workbench
cocos2d-python
eda
windows-explorer
smalldatetime
xml-comments
blogml
mkstorekit
resource-cleanup

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App