Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Some ideas about c? Date: Fri, 19 May 2017 12:18:07 -0700 Organization: None to speak of Lines: 37 Message-ID: References: <87tw4gwx4i.fsf@gmail.com> <1fHTA.24150$rp2.2619@fx31.iad> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="189d31b8aa2df37c9a5da9ba095e96a2"; logging-data="18620"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19pK+TCDSHLtg6llHG+4I9R" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:GaTv9EGAD0RPEOsb8y4VA/ZsOTk= sha1:L1seypcxiJaNRzTdE1IX1Q70AfE= Xref: csiph.com comp.lang.c:110410 scott@slp53.sl.home (Scott Lurndal) writes: > Gareth Owen writes: >>scott@slp53.sl.home (Scott Lurndal) writes: >>> Only if they pass the interview screening, and the superfluous colons >>> would be a huge red negative checkmark around here. >> >>I think you'd get through the screening (all other things being >>excellent) but you'd certainly get a "what's with all the ::'s?" as an >>interview question. > > I'm not so sure. We hire programmers here, and that would certainly > be a tickmark in the negative column. We don't look for people who > can leverage every feature of the language, but those who can solve > problems and maintain existing, sometimes decades old, code in > multiple languages (C, C++, Python, Perl, Verilog, SystemC are the > main languages). This is off-topic, since it's about C++, but I'll jump in anyway. There is a valid reason for writing, for example, `::std::string` rather than `std::string`. The identifier `std` is not reserved, so it would be possible to define a local class or namespace named `std` with a member named `string`. Then `std::string` would refer to that member, not to the standard type declared in the header. `::std::string` is unambiguous and doesn't break anything. It's a trick for avoiding a problem that's unlikely to occur in practice, and that can be easily avoided by not redefining `std`. It might partially guard against accidental inclusion of malicious headers, but if that's a possibility you're probably screwed anyway. It clutters the code and it's non-idiomatic. But it is defensible. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"