Skip to the content ForoHackers
Log inJoin

G++: the call I deleted is apparently the best man for the job

C++CompilersDebuggingStatic analysis
#18533 · · Quote · Report

Our teaching API has void scale(double); and void scale(int) = delete;. scale(2) says use of deleted function. I told the beginner there was a perfectly lovely double function and the compiler got twenty times ruder by producing my own declaration as evidence.

#18591 · · Quote · Report

deleted isn't invisible to overload resolution. for the literal 2 the int overload is an exact match. which overload wins if you give the other one an exact match of its own?

#18592 · · Quote · Report

scale(2.0) calls double. removing the deleted overload also lets 2 convert to double. three programs, two outcomes. a colleague said just cast every caller. that's about as helpful as painting both sides of a locked door green.

#18616 · · Quote · Report

nije dovoljno da poruka pokaže šta je zabranjeno. zašto je baš cijeli broj ovdje sumnjiv? u primjeru razlika izgleda kao jedna tačka.

#18618 · · Quote · Report

yes, why the ban? here the old integer callers think in percent. 2 means two percent to them; a factor of 2.0 doubles the drawing. an automatic cast would give the customer a perfectly compiled drawing one hundred times the requested size.

#18621 · · Quote · Report

pasé hace un mes un cartel de cinco centímetros a un tío que lo quería de cinco metros. un error que se deja detectar caminando hacia atrás tiene un coste de oficina considerable.

#18630 · · Quote · Report

we taught the new API as factor vs percentage with named entry points. a sloppy scale(2) still gets the intentional diagnostic on the old interface. the student's fix for two percent was 0.02, not adding an aesthetically pleasing dot to the wrong number.

You are not logged in, so this goes up anonymously: no account, no name and no address is stored with it, and it may carry no link and no image. Log in or join to post under your name. Our web server's logs keep the address and time of every request for up to 14 days; to keep yours out of them, use Tor. To reach the staff in confidence, use the drop. Sign as a returning source (a key kept only in this browser)

Sending takes a few seconds here: your browser first works out a proof of work against spam.

Reply