UFO:Alien Invasion
Development => Newbie Coding => Topic started by: xray on July 11, 2014, 08:38:35 pm
-
Hi,
I noticed in the source of list.h the following code:
template<typename T> inline T& LIST_Add(linkedList_t** const list, T const& data)
{
return *static_cast<T*>(LIST_Add(list, &data, sizeof(data))->data);
}
To my knowledge, templates are a C++ language feature. The coding guidelines state: use ANSI C99 only. I'm asking this because
I'm working on a hash table implementation. A generic hash table could be much easier written if we could use some of the C++ language features like "generics". How strict should I follow the guideline?
Any thoughts?
xray
-
Hi,
The coding guidelines state: use ANSI C99 only.
Disregard that, the coding guidelines are out of date, the project has since then been "converted" to C++, but the new guidelines were never fully agreed on (you can see some discussion on it here (http://ufoai.org/wiki/Talk:Coding/Guidelines) if you want)
-
Great. This simplifies some things a lot.
Does this mean the STL can also be used? This way, I can skip working on the hash table since STL already has excellent associative containers ready for use.
xray
-
about half of the programming team (including me) are against using stl
my personal reasons are: not thread safe, unsafe iterators, unsafe realloc behaviour. Not to mention compiler errors which do not fit into 256 characters and consist mostly of ::<>::<>::<>
-
about half of the programming team (including me) are against using stl
my personal reasons are: not thread safe, unsafe iterators, unsafe realloc behaviour. Not to mention compiler errors which do not fit into 256 characters and consist mostly of ::<>::<>::<>
A clear statement. Hadn't thought about these issues.
xray