← Back to team overview

yade-dev team mailing list archive

Re: Please do not use "using namespace boost" any more

 

Hi Feng,

thanks for advice. The work to remove all those
lines is the minimal. But the code will not compile,
if you do not change corresponding methods/class names.

https://github.com/yade/trunk/commit/297dc30508e7c4575aebc37c2e0dd1eb435387c4
https://github.com/yade/trunk/commit/697f1078b37c9803ce314441e6965227404b9dd8
https://github.com/yade/trunk/commit/8ddf512a66a7c4bbd608abfbf7e1ea7a5b1882de

It is completely fixed now. I just ask not to use this
construction for a new developing code.

Have a nice weekend

Anton


2014-05-23 16:59 GMT+02:00 Chen, Feng <fchen3@xxxxxxxxxxxx>:
> Hi, Anton:
>
> Will such script save you some time deleting the annoying lines :-)?
>
> find yadesrc -name '*.c' -o -name '*.cpp' -o -name '*.h' > files
> for file in files
> do
>     sed '/using namespace boost/d' file
> done
>
> Feng
>
> -----Original Message-----
> From: Yade-dev [mailto:yade-dev-bounces+fchen3=utk.edu@xxxxxxxxxxxxxxxxxxx] On Behalf Of Anton Gladky
> Sent: Friday, May 23, 2014 9:38 AM
> To: yade-dev
> Subject: [Yade-dev] Please do not use "using namespace boost" any more
>
> Dear Yade developers,
>
> I needed to update almost all files in Yade tree, removing "using namespace boost" all over *.hpp and *.cpp files.
> It is really annoying and time consuming task.
>
> I met the problems, compiling Yade against Boost 1.55 and VTK 6.1 (both of libs are newest versions). So the only correct way to fix it was to remove "using namespace boost" to escape name conflicts.
>
> Please, never use "using namespace boost" especially in header-files any more, because it mixes namespaces, what leads to a very difficult situation of name conflicts. Let those boost`s methods/typedefs etc.
> be a little longer, but it prevents us from such problems.
>
> I will try also to remove `using namespace std` (we have 46 of them all over the code), but I need to find time for that.
>
> Please the first answer here [1].
>
> [1] http://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice
>
> Best regards
>
> Anton
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-dev
> Post to     : yade-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-dev
> More help   : https://help.launchpad.net/ListHelp


References