Re: Creating more generic data structures
- From: Ben Bacarisse <ben.usenet@xxxxxxxxx>
- Date: Wed, 11 Aug 2010 13:47:16 +0100
Jorgen Grahn <grahn+nntp@xxxxxxxxxxxxxx> writes:
On Tue, 2010-08-10, Ben Bacarisse wrote:
Andrea Crotti <andrea.crotti.0@xxxxxxxxx> writes:...
and here the class definition:
http://gist.github.com/517457
This is code by someone who has taken the OO red pill. Many people have,
but even C++ does not do generic containers with classes (at least
that's not the key part of the way it's done).
do you see any sense?
Yes I do, but why are you not using C++? If you want this sort of
facility there has to be a sound reason not to use a language that has
it built in. I notice what looks to me to be a gccism is the code so
C++ might well be a real option. People on the team who don't know C++
can program in C-like C++ with very little learning. Alternatively, C
and C++ modules can be linked together with ease.
As primarily a C++ user, I tend to agree. It hurts my eyes to see
people reinventing wheels like std::queue<T>, in different ways every
time.
On the other hand ... what if you say "ok, from now on a C++ compiler
compiles our code, but stay away from everything except the standard
containers"? There is no way to enforce that, and it would slowly pull
more and more code over into C++ land. If I was a C user exclusively,
I don't think I'd like that.
That's true and the problem is not limited to C++. There are situation
where using limited features of C99 would help without hurting
portability (because you happen to know that features X and Y are
implemented on all the targets you care about) but once you drop C90
standard compiler flags, you won't be warned when other, less portable,
parts of C99 sneak in.
It would be good to have flags to turn features on an off (or to warn
about those that are off) individually, but I suspect the demand is low
compared to the effort of providing this facility.
--
Ben.
.
- References:
- Creating more generic data structures
- From: Andrea Crotti
- Re: Creating more generic data structures
- From: Nick Keighley
- Re: Creating more generic data structures
- From: Andrea Crotti
- Re: Creating more generic data structures
- From: Ben Bacarisse
- Re: Creating more generic data structures
- From: Jorgen Grahn
- Creating more generic data structures
- Prev by Date: Re: What happens on stack when a function calls another one
- Next by Date: Re: What happens on stack when a function calls another one
- Previous by thread: Re: Creating more generic data structures
- Next by thread: Re: Creating more generic data structures
- Index(es):
Relevant Pages
|