Boost logo

Boost :

From: Justin M. Lewis (boost_at_[hidden])
Date: 2003-05-04 05:07:27


----- Original Message -----
From: "Noel Yap" <Noel.Yap_at_[hidden]>
To: "Boost mailing list" <boost_at_[hidden]>
Sent: Saturday, May 03, 2003 9:37 PM
Subject: Re: [boost] Re: in/out parameters, codingstylesandmaintenance

> "Justin M. Lewis" wrote:
> > Again, you can do everything in C that we do in C++, there is a way to
do
> > it, so by your argument we shouldn't have ever moved to C++.
>
> I believe there's no way to do templates in C. I also see no way to
> have RAII in C. I know setjmp() and longjmp() can be used as a type of
> exception handling, but can it perform stack unwinding with object
> destruction?
>
> I think there's a huge value added when C++ handled virtual functions
> for me rather than doing it manually in C. There's also value added
> with the casting operators since it's easier to see what's happening. I
> see no value added with c_in, c_out, or c_in_out since the same can be
> accomplished with existing tools and they are no easier or harder to
> spot.
>
> > But, the point
> > here is, we know there are some nice features in C++ that make
programming
> > easier and cleaner, despite the fact that we CAN accomplish the same
things
> > in C. So, sometimes moving on to something new is justified. And in
the
> > case of c_out and c_in_out, their interfaces aren't so complex that
people
> > would have trouble figuring out their use.
>
> IMHO, these wrappers are not justified.
>
> > > > And as I pointed out there are very old C ways of doing everything
we
> > > > do in C++, but we all learned C++ anyway, because there are
advantages
> > to
> > > > the new C++ way of doing things.
> > >
> > > Not everything (eg templates).
> >
> > You don't need templates, you can do a lot of what is done with
templates
> > with either macros, or void *'s
>
> Macros don't have scope so I believe you can't just use macros.
>
> > Maybe they're leading sheltered lives?
>
> Or, maybe, judging from the code you've posted, you've (or someone else
> has) opted to have lots out parameters in the function calls. Like I
> said before, I'll avoid out parameters whenever possible.
>
> > I don't know. But, while boost
> > developers may not be buying into it, the people from the C++ IRC
channelw
> > here I originally discussed this idea do seem to like it. So do the
people
> > I work with.
>
> I think most on this thread, including myself, like the intent. We're
> disagreeing with the implementation of the intent.
>
> > > > Again, how do you differentiate the use of a dumb_ptr that's just
you
> > using
> > > > a pointer, because the function is expecting data that has been
> > allocated
> > > > with new, from an out, or in_out param?
> > >
> > > One more time:
> > >
> > > void f( dumb_ptr< T const > in_ );
> > > void f( dumb_ptr< T > inOut_ );
> > > dumb_ptr< T > f(); // out
> > >
> > > int i = 5;
> > > dumb_ptr< int const > in( &i );
> > > dumb_ptr< int > inOut( &i );
> > > dumb_ptr< int > out = f();
> > >
> > > f( in );
> > > f( inOut );
> > >
> > > Exactly what's confusing you with the above?
>
> No answer to my question? I'm really trying to understand why you're so
> adamant against using one template class in favor of two or three. Can
> you answer this question, please?
>

Why not do things like that? Well, for 1, you still have no concept of out
params there. 2, you've created 2 pointers to i, rather than just putting
it all nicely inline. And, you're still using pointers, not references.

> Thanks,
> Noel
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk