« first day (1484 days earlier)      last day (1641 days later) » 
18:00 - 22:0022:00 - 00:00

10:00 PM
Multiple TB spinning rust drives are cheap. Just get one. Surprisingly, I’ve found that one of the cheaper ways to buy them is often to buy an external drive, open it up, and remove the internal drive. Unless you want the external chassis, which you might. Alternatively, if you don’t need to access them regularly and just want a backup, use a cloud backup service. I haven’t looked into them because I’m too old-school, but I’m given to understand many are reasonably priced.
Ohh, Visual Studio. Thought you were talking about Windows. Yeah, VS is bloatware, especially if you install everything. You need to be very careful when you install, hand-selecting only the options you actually need.
 
I used old drives and device like this to access them
 
I have considered buying one of those on several occasions. Seen excellent prices on them for Black Friday. But when it comes down to it, I just can’t find any downside to leaving the side cover off my tower and hanging SATA cables out the side. :-)
 
user10957435
Yeah. I know. It's just doing all that takes time, which I don't always have. I've been meaning to get to it, it's just gotten pushed by other things.
 
@CodyGray I like to stay covered up so the "dongle" is a nice compromise, especially if it's USB 3.1. Otherwise I go the motherboard since I want the speed.
 
user10957435
@CodyGray My dad and I have done that before.
 
user10957435
10:05 PM
@JL2210 Okay, please just stop.
 
@Chipster Okay.
 
user10957435
@JL2210 Thanks.
 
user10957435
I have to say though, I like the features VS2019 claims to support: integrations with lots of different languages.
 
user10957435
Like I don't think Python was a think in VS before. Or maybe I just have a really old version :D
 
It’s been in there for a couple of versions now. I couldn’t care less… I end up installing the whole Visual Studio package just to get the Windows SDK and a C++ compiler....
Why on god’s green earth do I need Visual Studio if I’m going to write Python?
 
user10957435
10:15 PM
@CodyGray You don't But it's nice to have it I would imagine for people who use Python a lot.
 
Except people who use Python a lot don’t tend to use Visual Studio a lot
The big big advantage to VS is its world-class debugger. I don’t know if Python even supports that, or if it benefits from it.
 
The debugger is really on the only reason I use MSVS
 
user10957435
Fair enough.
 
I’ve never come across any debugger for native code on any platform that can hold a candle to VS
Even GDB is nowhere near as good as WinDBG, and both of them have the same drawback of having an exceptionally steep learning curve.
 
user10957435
Well, MSVS is targeted to Windows by the people who make Windows, so that is nice. But I'm sure there are other options now days that compare on that spectrum.
 
10:18 PM
For debugging, I haven't seen one.
 
Do you know of any? I’d love to have a comparable visual debugger for Linux. Haven’t found one
 
cough VSCode cough
 
Maybe it’s good. It forces me to write cross-platform code so I can debug it on Windows :-)
VSCode has a debugger? Thought it was just a bloated text editor
 
user10957435
@CodyGray Not for debugging. But I don't use Linux a whole lot.
 
Writing freaking text editors in HTML and other bloated languages is a new trend that boggles my mind.
 
10:20 PM
Looks like you can get it via an extension: code.visualstudio.com/docs/editor/debugging
 
Programmer’s Notepad is the way to go. Plain Win32, with the Scintilla text editor. Fast, responsive, predictable, stable, and native.
 
For python and my lowbrow needs there's pudb which is a bit like gdb --tui, just better. But I bet it's nowhere near an IDE's debugger. I don't use IDEs though.
 
user10957435
Speaking of bloated text editors, gedit was around on Linux before Notepad++ ever came out. That was one of the reasons I liked writing code on Linux, but didn't use it for C++.
 
user10957435
At least I think. It wasn't standard on Windows at least.
 
@CodyGray Plain Win32 doesn't work for most a lot of people.
 
10:22 PM
Geany is the rough Linux equivalent. The main difference is that Linux doesn’t have a true native GUI environment. It’s a Wild West out there. No chance for consistency.
@JL2210 It works for everyone; that’s the whole point. Why wouldn’t it?
 
Edit tip: ---text--- does strike through in chat.
2
 
Why's this place called the Ministry of Silly Hats?
 
This is a place for silly OT discussions and that is a fitting monty python reference.
 
user10957435
@JL2210 I always wondered that. Now I know.
 
Hmm... I want to namespace a function but it's in a header file.
 
10:29 PM
There was meme about a typo saying We hat fun. Mash that with the ministry of silly walks, and you get the ministry of silly hats.
 
Not cheap, but for capacity/speed/size (not too big, and not too small to lose) you can't beat a USB 3 SSD drive e.g. amazon.co.uk/Samsung-Portable-SSD-USB-External/dp/B074MCNDSK/…
 
@JL2210 You can put functions inside a namespace in a header file.
 
I know, but it'll be too big.
 
Declare it in the header file and then define it in the source file? You can reopen a namespace.
 
got the mud out of the carpets yet @Cody? :)
 
user10957435
10:31 PM
@StephenKennedy I'm American. Are pounds roughly equivalent to the US dollar?
 
@Chipster Google "pound to dollar ratio" (multiply by 1.29).
 
@Chipster No, that's about $375 US
(including 20% sales tax)
even easier is to Google: 292 gbp to usd
 
user10957435
@StephenKennedy Got you.
 
@StephenKennedy definitely not cheap. I can get a 1TB 970 pro for that price
 
user10957435
Yeah, I just did while I was waiting :D.
 
10:33 PM
@NathanOliver-ReinstateMonica but you don't get a shiny case!
 
It's in an RGB case ;)
 
user10957435
Also, if it ships from the UK, I might have to wait a bit. But you never know with Amazon.
 
@Chipster Oh I wasn't suggesting you buy from the UK. Not worth the hassle. I just used that link because (and I'm not sure if I've mentioned this before) I'm British
 
user10957435
@StephenKennedy Lol. Yeah, I figured as much. I think I've seen you joke about Brexit before, so I figured that was the case.
 
10:37 PM
Brexit isn't a jok... sorry, can't say it
 
user10957435
@NathanOliver-ReinstateMonica Oh wow, that actually is better. Not by a lot though.
 
that's the 2TB model tho
they do as small as 500GB
 
Only 1/3 my monthly wage :D
 
that's enough from me, I'm not a Samsung salesman :)
 
user10957435
America has its own crazy politics. I'm trying to keep up with my own, let alone British politics. So I don't always understand the Brexit jokes.
 
10:41 PM
@StephenKennedy I believe so, Stephen. The trickier issue is these cobwebs in my brain. Haven't found a way to remove those yet.
@JL2210 "too big"? No such thing. I assume you're worried about the fact that definitions in header files are inline? Compilers aren't that stupid anymore. Consider that all template functions need to be defined in headers.
 
10:57 PM
@CodyGray No, I mean the header file will get too large, and therefore hard to read.
 
Oh, I see. Then do what Nathan said. Namespaces aren't like classes. They can be re-opened at any time. And even class functions can be defined out-of-line, as I'm sure you know.
 
Yep. But for some reason class functions need to be passed a pointer to the class they are being called from.
 
What do you mean?
Who is they, and what don't they have?
 
I tried to create a function (namespace)z80emu::(class)z80::emulate(), and I tried to call it like z80emu::z80 *z80 = new z80emu::z80; z80::emulate(); and it didn't work.
 
You don't declare out-of-line namespace functions the same way you declare out-of-line class member functions. You need to open a namespace in the .cpp file: namespace z80emu { void z80::emulate() { ... } }
In other words, don't use the scope resolution operator to open a namespace.
 
11:05 PM
OK, now it says:
main.cpp:12:9: error: ‘z80’ is not a class, namespace, or enumeration
z80::emulate();
^~~
 
Is the z80 class actually defined in the z80emu namespace? Also make sure that you've included the header file that declares the z80 class.
 
user10957435
You know, come to think of it, I was considering getting a new compiler before. I was getting a new machine and decided to put linux on it (one of my projects I haven't had time for), and wait to mess with Windows until MSVS was fully C++20 compliant (or close enough). Because there is no sense in getting a new compiler and having it become instantly obsolete. Not while I'm getting a major compiler update anyway. So how long to you guys think it will take them to get C++20 working? A year maybe?
 
Wait, C++20 has been standardized?
 
Uhh...getting a new compiler isn't supposed to be a big ordeal. You just upgrade the compiler. I would not wait to start writing code until C++20 becomes standardized. Write portable C++17 code, and you will not have a problem.
 
@CodyGray Yes, it's a struct, though.
 
11:07 PM
@JL2210 Doesn't matter. There's no difference between classes and structs in C++, other than default visibility (classes default to private; structs default to public). In order to debug further, I'd probably have to see an MCVE. :-)
 
user10957435
@JL2210 Not yet, but it will next year.
 
user10957435
@CodyGray I guess. It's just in my mind it was because I was going to be installing Windows and everything. But you make a good point.
 
@JL2210 Oh...make sure that you don't have namespaces improperly nested. The nesting needs to match in the header file and the source file.
 
For hobbyist work there's something to be said for being an early adopter - not least that you get first shot at asking/answering about issues and features on Stack Overflow
 
@Chipster You can have multiple versions of a compiler installed on a single computer. Obviously GCC supports this, but so does VS. You can even use the latest version of the IDE to build using older toolchains.
It's also worth noting that Microsoft rarely leads the pack when it comes to implementing new C++ language standard features. The open-source GCC and Clang are usually ahead here.
 
user10957435
11:11 PM
@CodyGray So it might be a bit. Got you.
 
@CodyGray Let's see if I can shrink it down.
 
@StephenKennedy Ehh...at least with C++, we start getting plenty of questions just about the draft standard. I saw half a dozen questions about the "spaceship operator" before I even knew what the heck it was, since I can barely keep up with the bleeding edge, much less the pre-bleeding edge.
 
user10957435
Yeah, there's already a decent amount of C++20 questions.
 
I haven't seen anything in C++20 that is a "have to have" for me so far. Safer bit-casting is gonna be nice. And the micro-optimization enthusiast in me appreciates [[likely]] and [[unlikely]]
 
Please insert something witty here about C++ devs and C++ standards
 
11:15 PM
@CodyGray
namespace ns {
struct st {
void func(){}
};
}

int main(void)
{
ns::st *st = new ns::st;
st::func();
return 0;
}
 
First off, why in the world are you newing up that object instance? C++ isn't Java. And second, you can't call st::func() because func is a member function, not a static member. You need to call it on the instance: st.func().
 
user10957435
@CodyGray Concepts seems really nice if used correctly. Having a compile-time way to restrict templates is nice. It gives some guarantee what exactly you can do with what's handed to you in the template.
 
@Chipster There already exists a compile-time way to restrict templates: SFINAE. :-)
But yeah, haven't really looked into concepts. Might be useful.
 
@CodyGray There's 32 bytes in my class.
 
Mhmm. So?
You can allocate 32 bytes on the stack without breaking a sweat.
 
11:19 PM
I figured that was a candidate for dynamic memory allocation. That's usually how I do it in C.
 
user10957435
@CodyGray Well yeah, but allegedly it gives a much nicer error message as to what's wrong.
 
Even if you wanted heap allocation, new is the wrong way to do it. You want std::make_unique so that you have a smart pointer that automatically handles deletion.
Why would you want to avoid stack allocation unless absolutely necessary? I see that as an anti-pattern in C, as well.
@Chipster Error messages: forever the bane of C++ compilers. I'm not optimistic. :-)
 
user10957435
@CodyGray Fair enough.
 
How do you return a failure status from a C++ program? Just return EXIT_FAILURE; after #includeing <cstdlib>?
 
I've actually been relatively blessed where I work, because I can pretty much upgrade my toolchain whenever I want. So I've been taking advantage of C++17 features whenever I see fit. Normally, you don't have that level of flexibility in production-level systems.
@JL2210 Yes, if you want to return the status from main. Otherwise, individual C++ functions generally don't return error codes (although they can). Instead, they throw exceptions on failure.
 
user10957435
11:26 PM
I believe you can exit and give a status from inside a function.
 
Yes, you can, but you shouldn't...
To safely exit a C++ program, you should return from main. std::exit isn't going to invoke destructors like you expect, so you don't get object cleanup. See also: stackoverflow.com/a/30251056
 
Figured. That's just where I came from.
 
user10957435
One of the many "you can, but shouldn't"s of C++.
 
How about returning from a catch block in main?
 
The more interesting question is, is there anything you can't do in C++? There's plenty of things you shouldn't do.
@JL2210 Sure, you have no choice. Returning from main is the only place where you're going to use EXIT_SUCCESS and/or EXIT_FAILURE.
I personally do it that way. My command-line applications have the main function wrapped in a try/catch so that I can just throw exceptions willy-nilly, and have the catch block in the main function display a pretty error message. Opinions may vary on whether or not this is good style.
 
user10957435
11:30 PM
@CodyGray Does ill-formed or undefined behavior count as something you can't do or shouldn't do?
 
std::exception.what() doesn't seem to give very good info. Any way to embed a string there?
@Chipster Some of both. An ill-formed program may give a compiler error.
 
@Chipster Shouldn't. You can certainly invoke UB. It is well-defined by the spec. :-)
@JL2210 Yes... You specify the string when you throw the exception: throw std::runtime_error("This is where your detailed error message goes.");
 
Ah. I was using throw std::exception;.
 
user10957435
@CodyGray Good point.
 
@CodyGray What do you #include for std::runtime_error?
 
11:33 PM
If all you're going to do is print the error message, there's no real reason to throw anything but std::runtime_error. If you actually want the caller to be able to handle the exception, then I would recommend creating a subclass of std::runtime_error so that the caller can specifically catch that type of exception. Rule of thumb: don't catch exceptions you can't handle. The main function is the obvious exception to that, when you're defining a global unhandled exception handler.
 
user10957435
@JL2210 That's true. It just depends on what behavior you're "trying" to invoke I guess.
 
@JL2210 #include <stdexcept>. I don't memorize which header files to include, BTW. Just Google the object name: en.cppreference.com/w/cpp/error/runtime_error
@JL2210 Even std::exception has a constructor that lets you specify a string. This is what the what() member function returns. And it allows you to call what() on anything that inherits from std::exception, which all exceptions should. You can just as well throw std::exception, but I tend to prefer std::runtime_error for, uh, runtime errors.
 
Hmm... There's no ENOSYS for "not implemented" in C++. I'm just going to throw a temporary exception until this is complete. Do you know any alternative?
 
@JL2210 There actually is, starting in C++11. Folks don't tend to use use error codes in C++, though. Throw an exception. std::logic_error, perhaps, or std::domain_error, or your own derived not_implemented_exception class.
 
Any options for argument parsing?
 
11:46 PM
getopt is POSIX
Nothing that I know of in the standard library
I wrote my own parser. cue dark cloud of shame
 
So, essentially just DIY?
 
Well, the thing is, there's no standard cross-platform argument parsing. Windows does it differently than POSIX. So there isn't much the standard library could really do, unless it chose to simply standardize what POSIX already has semi-standard.
You kind of have to decide how you want to handle argument parsing.
 
So, just use argc and argv?
 
So, for me, I have a class that parses switches, accepting "-" on both platforms and also "/" on Windows. It follows my convention that capital letter switches imply an associated argument, whereas lowercase letter switches don't have any associated arguments. It handles all sorts of different separators, including no separator at all. And it also returns a vector of all space-delimited arguments not associated with a switch. The only thing it doesn't do is support multiple-character switches.
Yeah, of course. You've no choice but to parse argc and argv.
If you want that. Or, just read a config file. :-) Boost has you covered there. Actually, come to think of it, Boost almost certainly has a command-line argument parser, too.
 
18:00 - 22:0022:00 - 00:00

« first day (1484 days earlier)      last day (1641 days later) »