Boost logo

Boost :

Subject: [boost] [algorithm][hex] function hex_char_to_int in unnamed namespace in header file
From: Felipe Magno de Almeida (felipe.m.almeida_at_[hidden])
Date: 2012-11-27 12:55:05


AFAIK, unnamed namespaces are dangerous in headers. There is a
commentary just above the function definition:

// this needs to be in an un-named namespace because it is not a template
// and might get included in several compilation units. This could cause
// multiple definition errors at link time.

But it seems the better thing would be to define it inline. It is
exactly because it can be used in several
translation units that it can cause an ODR violation if defined
in a unnamed namespace AFAIK.


Felipe Magno de Almeida

Boost list run by bdawes at, gregod at, cpdaniel at, john at