bugCompact Disc Input and Control Library - Bugs: bug #60139, iso9660.hpp pollutes global...

 
 

bug #60139: iso9660.hpp pollutes global namespace with STL

Submitter:  yol <yol>
Submitted:  Sat 27 Feb 2021 10:20:40 PM UTC
   
 
Category:  API Severity:  5 - Average
Item Group:  libiso9660 Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 03 Mar 2021 07:14:22 PM UTC, comment #6: 

hm it seems you changed the message of the merge commit with the amend. Anyway, probably best to just leave it be now. Thanks!

yol <yol>
Mon 01 Mar 2021 06:32:49 PM UTC, comment #5: 

Hmmm... I am not sure why that doesn't appear either.

Fixing the test was done after applying the patch, and I don't know why the two commits were seen as one.

So did a git commit --amend to update the commit message.

Here is what git log now shows:


git log 95479463eee2c4f84586d8a35d0fe678e54d2d1f
commit 95479463eee2c4f84586d8a35d0fe678e54d2d1f
Merge: 197fcef4 73358383
Author: R. Bernstein <rocky@gnu.org>
Date:   Sun Feb 28 16:35:30 2021 -0500

    Remove "using namespace std" from iso9660.hpp

    "using" declarations in headers pollute the namespace of library users
    and are therefore discouraged, see
    http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rs-using-directive

    Patch from Philipp Kerling <pkerling@casix.org>

commit 73358383f15558f5646d1f19f3691cbd2a1ad660 (origin/iso9660.hpp-no-std, iso9660.hpp-no-std)
Author: R. Bernstein <rocky@gnu.org>
Date:   Sun Feb 28 16:34:41 2021 -0500

    Correct path in  C++ tests

commit 197fcef47b547739534df5837592edfcad4dba40



Rocky Bernstein <rocky>
Group administrator
Mon 01 Mar 2021 04:08:13 PM UTC, comment #4: 

Thanks! Content looks fine to me, although it looks a bit strange to me that the commit description does not mention the removal of the using statement, but instead only refers to the tests.

yol <yol>
Sun 28 Feb 2021 09:40:52 PM UTC, comment #3: 

Applied in merge of 106d5c30

Please double check though.

Rocky Bernstein <rocky>
Group administrator
Sun 28 Feb 2021 07:36:10 PM UTC, comment #2: 

Hey,

I didn't really get how to do pull requests on Savannah, so I just attached the patch. You can get the commit directly when you use `git apply-patch`.

yol <yol>
Sat 27 Feb 2021 11:26:16 PM UTC, comment #1: 

Ok - if you are up to it clone the project make the changes in a branch so that a git request-pull can be done.

Alternatively submit a patch here.

Thanks.

Rocky Bernstein <rocky>
Group administrator
Sat 27 Feb 2021 10:20:40 PM UTC, original submission:  

cdio++/iso9660.hpp contains the line "using namespace std;". This means that for every source file in a program that #includes this file, every name defined in the STL namespace std is imported into the global namespace. This is considered extremely bad practice to do in headers (see, e.g., http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rs-using-directive ), as it may lead to name clashes and cannot be prohibited or reverted by the user. It would be much preferable to remove that line and instead fully qualify the few STL usages in the header such as `vector`.

yol <yol>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rocky (Posted a comment)
  • -email is unavailable- added by yol (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-02-28 yol Attached File- Added 0001-Remove-using-namespace-std-from-iso9660.hpp.patch, #50949

    Back to the top

    Powered by Savane 3.14-f13d.
    Corresponding source code