awesome-competitive-programming icon indicating copy to clipboard operation
awesome-competitive-programming copied to clipboard

Adding #define shorthands

Open steven-mathew opened this issue 6 years ago • 3 comments

I think you should add useful c++ shorthands.

steven-mathew avatar Jan 28 '19 18:01 steven-mathew

Do you mean code snippets such as how to break down a space-separated input with strtok? Or quick tutorials for C++ STLs?

lnishan avatar Mar 07 '19 02:03 lnishan

I was thinking of C++ macros. For example, a macro for a for loop in the range [l,r]: #define fore(i, l, r) for (int i = (int)(l); i <= (int)(r); i++). These would be useful to add to a competitive programming repo.

steven-mathew avatar Mar 07 '19 02:03 steven-mathew

I'm not sure - this is 100% my personal opinion, that those macro defines should be discouraged. These tend to lead to bad coding practices later on. IMO, if we were to mention these techniques, we would need to add a strong caution against using them in regular programming.

lnishan avatar Jul 26 '20 01:07 lnishan