Development > Newbie Coding

ANSI C99 guideline & c++ generics language feature

(1/1)

xray:
Hi,

I noticed in the source of list.h the following code:


--- 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);
}

--- End code ---

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

DarkRain:
Hi,


--- Quote from: xray on July 11, 2014, 08:38:35 pm ---The coding guidelines state: use ANSI C99 only.

--- End quote ---

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 if you want)

xray:
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

Sandro:
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 ::<>::<>::<>

xray:

--- Quote from: Sandro on July 13, 2014, 09:26:51 pm ---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 ::<>::<>::<>

--- End quote ---

A clear statement. Hadn't thought about these issues.

xray

Navigation

[0] Message Index

Go to full version