zen0wu / topcoder-greed

greedy editor for topcoder arena
Apache License 2.0
229 stars 45 forks source link

Add .LongInteger field to the Type object #35

Closed vexorian closed 11 years ago

vexorian commented 11 years ago

Hello, this very minor tweak is related to issue: http://github.com/shivawu/topcoder-greed/issues/34

By allowing to use .LongInteger in conditions, We can detect 64 bits integers in the templates. I added this so I can make greed write "long" instead of "long long" in my c++ template. This will also allow the tester template to do some things different if needed in case the type is long.

vexorian commented 11 years ago

Yeah, the .LongInteger field was working fine until I noticed that if a function's arguments use vector, you can't use a vector to call it. So I actually needed to modify all the tester code to use complicated replaces like those in the method template who rely on .LongInteger. It was too much work.

The new commit adds templates.cpp.longLongName to config so now the "long long" can just be replaced.

wookayin commented 11 years ago

A nice extension point. Actually, I don't think I like your preferences on 64-bit integer types in C++, because long is guaranteed to be 64-bit in some platform, although in the topcoder environment long is actually 64-bit.

But, in my opinion, greed affords this configuration point. A suggestion: use suffix longTypeName instead of longLongName, since this is much more generic form across all the other languages.

vexorian commented 11 years ago

Well, in the patch only c++ has this option, it doesn't seem worth it to add it to the other languages because they don't allow changing type names anyway. I will rename it longTypeName though, it is easier to read.