Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Bad code here

Sign in to follow this  


For those of you that remember this journal entry, I was playing around with the evilness and found a couple of problems with the macro. Here's what the current version looks like now:

struct LtProxy {
LtProxy(T r) : ref_(r) {}
T ref_;
LtProxy & operator=(const LtProxy &);

#define MAKE_OPERATOR(name, lhs_type, rhs_type, result_type, worker_function) \
const struct name ## _t {} name; \
inline LtProxy operator <(lhs_type lhs, name ## _t) { \
return LtProxy(lhs); \
} \
inline result_type operator>(const LtProxy & lhs, rhs_type rhs) { \
return worker_function(lhs.ref_, rhs); \

It's still bad code, but it's better bad code. As in, it compiles in more situations and produces fewer warnings.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!