Skip to main content
14 events
when toggle format what by license comment
Jul 1, 2021 at 6:17 comment added Toby Speight I don't find C++ casts particularly readable. But I'd argue that's a good thing - it encourages us to really question which casts really are necessary, and eliminate the rest. It may even make me write that one as 1.0f * image.getWidth() / width to use standard conversions instead. C++ casts are safer than C casts, because it's clearer which aspects you intend to change (e.g. you can't accidentally cast away const).
Jun 30, 2021 at 23:03 history edited JDługosz CC BY-SA 4.0
a few run-on sentences and a missing word
Jun 28, 2021 at 21:52 comment added Cris Luengo @JimmyHu When you first mentioned the issue with the order, I had forgotten that we're not talking about class member functions, but free functions. Things are different there. I have added some text to this respect in the answer, I hope that clarifies things. If you make sure to compile with -Wall, the compiler will warn you about lots of things that are not really OK, but it can work around. You get best code when you fix all warnings generated by this flag.
Jun 28, 2021 at 21:45 history edited Cris Luengo CC BY-SA 4.0
added 1470 characters in body
Jun 28, 2021 at 18:02 comment added JimmyHu Thank you for trying. If you figure out the reason, please let me know.
Jun 28, 2021 at 17:11 comment added Cris Luengo @JimmyHu: Thanks, I have the same compiler on macOS, I want to play with this to see if I can figure out the reason.
Jun 28, 2021 at 16:55 comment added JimmyHu g++ under MacOS: g++-11 (Homebrew GCC 11.1.0_1) 11.1.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Jun 28, 2021 at 16:30 comment added Cris Luengo @JimmyHu: Wow, that’s weird. What compiler do you use? I would logically place the function that contains the actual code first, and the “aliases” with different inputs after, but the order shouldn’t matter for the compiler.
Jun 28, 2021 at 16:09 comment added JimmyHu However, if the single standard deviation version definition is put after the multiple standard deviations version definition, there is no error occurred.
Jun 28, 2021 at 16:06 comment added JimmyHu Thank you for the answering. Your functions gaussianFigure2D and gaussianFigure2D2 don't need different names. I would argue the library would be easier to use if they had the same name. The compiler will pick the one or the other function depending on the arguments passed. I found a thing is that the compiler (g++-11 11.1.0) says "error: no matching function for call to 'gaussianFigure2D(const size_t&, const size_t&, const size_t&, const size_t&, const double&, const double&)'" if those functions with same name.
Jun 27, 2021 at 16:29 vote accept JimmyHu
Jun 26, 2021 at 22:45 history edited Cris Luengo CC BY-SA 4.0
deleted 1 character in body
Jun 26, 2021 at 18:39 history edited Cris Luengo CC BY-SA 4.0
added 1 character in body
Jun 26, 2021 at 18:09 history answered Cris Luengo CC BY-SA 4.0