lnishan / awesome-competitive-programming

:gem: A curated list of awesome Competitive Programming, Algorithm and Data Structure resources
http://codeforces.com/blog/entry/23054
Creative Commons Attribution 4.0 International
12.56k stars 2.57k forks source link

Adding #define shorthands #69

Open steven-mathew opened 5 years ago

steven-mathew commented 5 years ago

I think you should add useful c++ shorthands.

lnishan commented 5 years ago

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

steven-mathew commented 5 years ago

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.

lnishan commented 4 years ago

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.