I'm looking at CPP-NETLIB's source code and came across this syntax where it describes the concepts.
template <class R> struct ClientRequest : network::Message<R> {
BOOST_CONCEPT_USAGE(ClientRequest) {
std::string tmp;
R request_(tmp);
swap(request, request_); // swappable via ADL
std::string host_ = host(request);
boost::uint16_t port_ = port(request);
std::string path_ = path(request);
std::string query_ = query(request);
std::string anchor_ = anchor(request);
std::string protocol_ = protocol(request);
request << uri(std::string());
network::http::uri(request, std::string());
(void) host_;
(void) port_;
(void) path_;
(void) query_;
(void) anchor_;
(void) protocol_;
}
private:
R request;
};
I can't seem to find any explanations that describe how the (void) conversion of in-scope types could be necessary or what it would do. Why would you need to clear the stack before ending the BOOST_CONCEPT_USAGE member function? What else would it do if not clearing the stack?
Implicit type conversion in C happens automatically when a value is copied to its compatible data type. During conversion, strict rules for type conversion are applied. If the operands are of two different data types, then an operand having lower data type is automatically converted into a higher data type.
Implicit conversions allow the compiler to treat values of a type as values of another type. There's at least one set of scenarios in which this is unambiguously bad: non-total conversions. That is, converting an A to a B when there exists A s for which this conversion is impossible.
An implicit conversion sequence is the sequence of conversions required to convert an argument in a function call to the type of the corresponding parameter in a function declaration. The compiler tries to determine an implicit conversion sequence for each argument.
Implicit type conversion in C language is the conversion of one data type into another datatype by the compiler during the execution of the program. It is also called automatic type conversion.
It's just for suppressing the compiler's warnings about unused variable, nothing special.
It does NOT clear the stack in any way, if that's what you mean.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With