svn commit: r268491 - head/usr.bin/users

Pietro Cerutti gahr at FreeBSD.org
Thu Jul 10 15:42:18 UTC 2014


On 2014-Jul-10, 17:29, Ed Schouten wrote:
> On 10 July 2014 17:23, Pietro Cerutti <gahr at freebsd.org> wrote:
> > It's because of the standard library. Examples:
> >
> > /usr/include/c++/v1/memory:1454:47: error: unused parameter '__a'
> > [-Werror,-Wunused-parameter]
> >         static void construct(allocator_type& __a, _Tp* __p)
> >
> > /usr/include/c++/v1/__functional_base:85:12: error: cast from 'const
> > volatile char *' to 'wchar_t *' increases required alignment from 1 to 4
> > [-Werror,-Wcast-align]
> >     return (_Tp*)&reinterpret_cast<const volatile char&>(__x);
> 
> Then I would suggest that these specific warnings (-Wunused-parameter)
> were to be disabled for C++ programs. The actual consumers should not
> have to lower their WARNS, simply because the standard library is
> broken.
> 
> > Yes, except std::set implements bidirection iterators instead of random
> > access iterators. Bidirectional iterators do not support arithmetic with
> > integers, which I need to get to the previous-to-last element in the
> > very next line of code.
> 
> The decrement operator is sufficient for this:
> 
> http://80386.nl/pub/20140710-users.txt
> 
> >> Even though I actually think C++ is a lot nicer than C, do we really
> >> think it is actually worth proactively replacing already existent
> >> tools? This specific tool has now become three times as big as the
> >> previous version (7128 -> 23840 bytes).
> >
> > No, I'm not going to systematically replace everything with c++. The
> > thing is, I had already begun to refactor a bit users(1), and this
> > looked like the natural next step to me. Of course, here the trade off
> > between code readability and object size shows.
> 
> With the patch above, the binary shrinks to 15640 bytes, so my
> concerns are somewhat addressed. :-)

Yep that's a valid approach too. Feel free to get it in :)

-- 
Pietro Cerutti
The FreeBSD Project
gahr at FreeBSD.org

PGP Public Key:
http://gahr.ch/pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 949 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/svn-src-head/attachments/20140710/d62b9a9f/attachment.sig>


More information about the svn-src-head mailing list