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

Bad Memory Allocation when using Frozen Graph
QT project crashing on profile, running with release and debugger
Using reinterpret_cast to convert integer to pointer and back to integer [duplicate]
C++ suduko puzzle, initialising grid - newbie [closed]
How to swap lines in a text file?
Parent variadic function template specialized in child
How does the quality of 128 bit MurmurHash3 change in case of small key length or output truncation?
Raw socket SYN vs. packet socket SYN
How to construct a list of files from the `start group … end group` linker option
How to exclude isolated nodes from generated Doxygen Class Hierarchy
Why might compiling with -march=native cause “pointer being freed was not allocated”?
Cant access correct number of vertices for a 3d model (.OBJ) using Assimp
In using-declaration, can dependent names render to constructors after template substitution?
How to add C++ files to the Objective-C/C++ OpenGL ES project
Using Eigen in custom tensorflow op
Create JSON structure based on input variables

Categories

HOME
datatables
firebase-authentication
multidimensional-array
firmware
masonry
payment
netlogo
ignite
google-places-api
mariadb
android-animation
pstricks
terraform
apache-spark-2.0
spf
crc32
datepicker
zk
salt-stack
adodb-php
bit-manipulation
markup
uidocumentinteraction
integer
azure-storage-blobs
gulp-sass
postmates
wikitude
deprecation-warning
mikrotik
phylogeny
frama-c
floyd-warshall
eureka-forms
atom-feed
gtm-database
inorder
live
aircrack-ng
gulp-4
gsutil
sharethis
webdrivermanager-java
web.py
ats
configuration-files
oclazyload
itunes-store
jes
pywinusb
enterprise-library-6
exports-loader
jquery-ui-widget-factory
spectral-density
shared-ptr
django-media
smartmeter
google-chrome-arc
pdfobject
review-board
compass
nested-attributes
jedit
smslib
amdatu
safari9
rich-snippets
compiler-options
jquery-dropkick
coderunner
kiosk-mode
string-search
ember-qunit
jml
tracker
orca
resharper-plugins
duplicate-removal
kiwi
maptiler
socketrocket
where-in
rounded-corners
divshot
real-time-data
jsonexception
dynamic-languages
backbone-forms
jax-rpc
visual-assist-x
static-array
custom-view
viewstack
mono-service
wind-river-workbench
kiln
wcsf
fql.multiquery
vtl
nsenumerator
oracle8i
microsoft.build
maintenance-plan

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile