Posts by uliwitness@mastodon.technology
 (DIR) Post #9hIMHydSwp52jlmgpk by uliwitness@mastodon.technology
       2019-03-30T11:23:12Z
       
       0 likes, 0 repeats
       
       I have a common pattern:stringstream err;err << “Can’t do” << x << “ with a ” << y;log(err.str());throw runtime_error(err.str());Can I somehow simplify this? Maybe likelogAndThrow() << “Can’t do” << x << “ with a ” << y;?
       
 (DIR) Post #9hKCoY2wDSOAbSVjyS by uliwitness@mastodon.technology
       2019-03-31T08:50:38Z
       
       0 likes, 0 repeats
       
       @mdhughes Yeah I try to avoid macros where I can. Too many chances to evaluate arguments twice, or make mistakes when used in if/then constructs (like your extra semicolon after the while(0) here).
       
 (DIR) Post #9hKGAiczr1kfeedlyq by uliwitness@mastodon.technology
       2019-03-31T09:28:15Z
       
       0 likes, 0 repeats
       
       @mdhughes It's a problem if used in the "if" clause of an if/then/else. If you don't put braces around your if statements, the else might associate with the wrong thing. Also, in -Werr builds, this will give an empty statement warning.
       
 (DIR) Post #9hKGPscoy28v0JmuDA by uliwitness@mastodon.technology
       2019-03-31T09:30:02Z
       
       0 likes, 0 repeats
       
       @mdhughes Isn't that the whole point of using do {} while(0) in your macro definitions? To have something that requires that semicolon just like a real function?
       
 (DIR) Post #9hKHfx6GCJXDTCml3g by uliwitness@mastodon.technology
       2019-03-31T09:35:19Z
       
       0 likes, 0 repeats
       
       @mdhughes Not trying to harp on what was obviously just a typo on code written in a status, but it illustrates very well one of the subtleties of why I try to avoid macros in C++ unless I need to stringify or token-paste.
       
 (DIR) Post #9hKHfxFpcjBtwtGOye by uliwitness@mastodon.technology
       2019-03-31T09:40:50Z
       
       0 likes, 0 repeats
       
       @mdhughes That and the naïve version of FOO(msg) do { log(msg); throw runtime_error(msg); } while(0) possibly evaluating msg twice (and thus changing behaviour if msg involved e.g. popping the error message off a stack).Of course, in plain C you sometimes have no choice, but macros are always a last resort after inline functions and templates for me.
       
 (DIR) Post #9hKsVkeRK798Gklu9A by uliwitness@mastodon.technology
       2019-03-31T11:38:51Z
       
       0 likes, 0 repeats
       
       Whoa! Thanks to all the kind strangers who upvoted my Stackoverflow answer back into the positive range!Upon feedback, I slightly adjusted the message to no longer personally address the OP, as you’re right, that could be read as condescending/insulting, even if not intended.
       
 (DIR) Post #9hObtfW7KQr5jSH6y8 by uliwitness@mastodon.technology
       2019-04-02T09:00:36Z
       
       0 likes, 0 repeats
       
       So, when you people open a bottle, which hand do you use to unscrew the cap, and which to hold the bottle? And are you a rightie, lefty, or ambidextrous?I’m having the feeling that although a rightie, I seem to be doing numerous things “with the wrong hand”.
       
 (DIR) Post #9iIX38udtML67Ov4Cm by uliwitness@mastodon.technology
       2019-04-29T11:15:01Z
       
       0 likes, 0 repeats
       
       Unpopular opinion: nano should be the default editor on all Linux distributions, and you should never ship an OS distro with vi as the only option.vi is 1969 GUI. Start up in insert mode, switch commands to Ctrl+Something shortcuts and show read/write/quit hints onscreen to fix
       
 (DIR) Post #9ikBc71OnuHGmLbQzg by uliwitness@mastodon.technology
       2019-05-12T19:27:15Z
       
       0 likes, 1 repeats
       
       Finally restored my C tutorial pagehttps://masters-of-the-void.comI did a few text revisions during the conversion to Jekyll, but haven’t yet bothered to redo all the screen shots for Xcode 10.
       
 (DIR) Post #9iy8jDFH8gzsxdxovo by uliwitness@mastodon.technology
       2019-05-19T12:59:07Z
       
       0 likes, 0 repeats
       
       Also cool:Swift avoids the issues of C’s ability to accidentally “capture” the line after an “if” because it always requires {} around conditional and loop bodies.It’s not possible to accidentally use assignment statements as conditionals (i.e. = in Swift returns Void).
       
 (DIR) Post #9j14sg8ZGyFQpaxrPM by uliwitness@mastodon.technology
       2019-05-20T23:06:21Z
       
       0 likes, 0 repeats
       
       @mdhughes But in most cases that's not needed. E.g. you can write:while let currLine = readLine() {    ...}So random C functions may not work, but if you're designing your own calls, you can easily cater to the strengths of the languages.
       
 (DIR) Post #9j16VGS0o97iPk1RUO by uliwitness@mastodon.technology
       2019-05-20T23:08:32Z
       
       0 likes, 0 repeats
       
       @mdhughes Your complaint is a bit like when people complained that C++'s catch statement didn't have a finally clause.It doesn't have that because C++ programmers use RAII for cleanup, which is much safer.
       
 (DIR) Post #9jMbjXWon2hGUjCmP2 by uliwitness@mastodon.technology
       2019-05-31T08:20:09Z
       
       1 likes, 0 repeats
       
       My biggest UI annoyance these days is stuff re-arranging under my finger just as I’m about to tap.We need to avoid that more, and if we can’t, indicate UI in flux better, e.g. using progress indicators.
       
 (DIR) Post #9jgHysxilooFOquQoy by uliwitness@mastodon.technology
       2019-06-09T19:21:21Z
       
       0 likes, 0 repeats
       
       So my “% CPU” column in Activity Monitor is empty. Anyone know how to get it back?
       
 (DIR) Post #9jpiFPavYeX6TIQamW by uliwitness@mastodon.technology
       2019-06-14T09:20:53Z
       
       0 likes, 0 repeats
       
       I wish I could sort Xcode’s error list by error type. So that if I just made a function throw and now have 5 dozen “call can throw, but is not marked with try” messages I could easily do them in one go.
       
 (DIR) Post #9kduwylorm5pzOFfua by uliwitness@mastodon.technology
       2019-07-08T10:20:41Z
       
       0 likes, 0 repeats
       
       A little banged up from the transport from home to work, but otherwise these homemade burgers are delicious 😋
       
 (DIR) Post #9mCrra4lAiOh5pGp5k by uliwitness@mastodon.technology
       2019-08-24T09:13:23Z
       
       0 likes, 0 repeats
       
       @fribbledom A while ago I realized there is not even a way to write a C program that returns a hash map/array to whatever shell called it. Would really be amazing to have a standard for that.
       
 (DIR) Post #AOIoUQwvVDPSnTQeKe by uliwitness@mastodon.technology
       2022-10-06T20:09:56Z
       
       0 likes, 1 repeats
       
       Mastodon dot technology is shutting down: https://ashfurrow.com/blog/mastodon-technology-shutdown/Thanks @ashfurrow for being such a great host, and take care, totally understandable that you can't carry on right now.Anyone have tips on migrating between instances? Last I heard there was some special care to take to move the list of people I follow over?
       
 (DIR) Post #AOIx7EYGKXaHGyu9NA by uliwitness@mastodon.technology
       2022-10-06T21:48:43Z
       
       0 likes, 0 repeats
       
       @tewha From what I heard it was the opposite: mastodon can do a redirect for everyone that follows you.