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

integer minus a class [on hold]
Amazon AWS CPP SDK Get S3 Bucket Download Progress
IDEA CLion 2016.2.1 can't recognize the function exit()
Audacity PCM Data [on hold]
Best practice to set up qt application that works for different DPI
openssl fips error on arm Linux
C++ - Pretty way to make frequencies add up to 1
integerset obtaining the given array
Arduino Invalid conversion from 'char' to 'char*'
virtual ClistCtrl with checkboxes on displayed report list style
Error when modifying vector member of another class
Interrupt Service Routine can't be called directly
Lambda capture by default reference vs named
convert bitset<64> to string every 8 bit
argument of type “int” incompatible with parameter of type “int”
When is the correct time to call restoreState for QHeaderView?

Categories

HOME
phpunit
dll
cron
raster
ruby-on-rails-4
multidimensional-array
jsoup
knn
screensaver
migration
modularity
chart.js
opentsdb
http-headers
access-control
kafka-consumer-api
serenity-bdd
robocopy
scons
sandbox
cropper
heatmap
jqassistant
side-effects
induction
kinvey
pam
fixtures
crossfilter
direct3d9
kernel-module
xfs
pivottable.js
card-flip
marytts
webos
parasoft
trace
data-processing
enterprise-library-6
sp-executesql
erpnext
oltp
icingaweb2
implicit
topshelf
erlang-shell
collaborative-filtering
code-signing-entitlements
local-variables
vibration
gio
sharepoint-userprofile
mechanize
ienumerable
f#-interactive
ntfs-3g
customdialog
inventory
struts2-jquery-grid
android-6.0.1
octopress
rebase
velocity.js
8085
android-context
ti-nspire
bullseye
xcode-bots
tstringgrid
bitarray
du
grunt-contrib-cssmin
centura
componentone
searchqueryset
ransac
stacked-area-chart
apache-commons-exec
invalidation
countries
inference
mathtype
capability
ora-01426
memory-profiling
google-doodle
spaces
cgpoint
layar
django-generic-views
openflashchart2
loose-coupling
white-box-testing
google-notebook
flashlite

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile