Hacker News new | past | comments | ask | show | jobs | submit | vitosartori's comments login

That's a huge pain point, but I'm curious! What would be a good approach in your opinion? I'm not questioning the exit/print error and carry on, that's plainly wrong. When working on private projects/libs, my functions usually return an enum error type, and do all data handling - be it arguments or returns - through pointers passed as args; I mean, I think that's the usual convention, but you clearly have way more experience, so I thought about asking! :)

Looking at you, syscall!


On Windows, this problem is already solved well. Return 32-bit integers which conform to that spec: https://learn.microsoft.com/en-us/openspecs/windows_protocol... Possible to pack OS errors, third party library specific errors, and other classes of errors into a single value.

Technically, you can implement that spec for all OSes. I did a few times, defining vendor-specific facilities for Linux components I used, like xwindows, drm/kms, etc..


How do you return an error that communicates "missing quote on line 42 character 200"? A much better solution is to use std::expect (or something home baked if not available) and make the error type something that holds an actual context. HRESULT is a remnant of the past, not something you should replicate in your own code if you have the choice.

https://en.cppreference.com/w/cpp/utility/expected


> How do you return an error that communicates "missing quote on line 42 character 200"?

For that use case you gonna need some other piece of data besides the error code. Maybe another type like json_error_t in Jansson library. Or maybe a special strings, like the ones returned by sqlite3_errmsg() in SQLite library.

> not something you should replicate in your own code if you have the choice

I believe HRESULT, despite rather old, is still the best error handling strategy overall.

Language-specific solutions like std::expected don’t work because all complicated software is written in multiple programing languages. For example, the entire ML ecosystem uses Python. 32-bit integers and strings are as language agnostic as you can possibly get.

Enums don’t work because most non-trivial libraries have an unbounded number of possible error conditions. You made a parser library for some format, defined an enum containing all possible failures of the parser, but then a user tried to parse a file he doesn’t have read access to. The failures need to include disk I/O errors. Another user gonna parse their source file from a mounted network share, the failures returned from your parser now need to include TCP/IP errors.


Typically, you have a parser handle and can use that to query it about various aspects of its state. Here it would include line number, character offset, and byte offset. The type of error can be encoded in the error return value.


oh dear - i remember teaching people on COM training courses about HRESULTs - never again, please!


Unfortunately WinDev has decided all modern Windows APIs are based on COM.

They aren't alone, Apple's XPC, Android and Fuchsia's Binder, and even Linux D-DBus, aren't much different.

They have much better tooling though, something that Microsoft folks keep ignoring, so I understand where the pain comes from.


well, i guess in C you should return a value indicating the error probably via a struct that contains the error and the success data. C programmers seem to have a terrible aversion to returning structs (possibly they don't realise that you can do it?) where in other value-based languages (e.g. c++, go) it is very common.

of course, there are reasons for mucking around with pointers. but down that route lies pointers-to-pointers, and eventually madness.


Perhaps a better link would be https://en.wikipedia.org/wiki/Maestro_I?



> How does Unity estimate the Runtime Fee when I have not supplied data?

> While we always recommend you supply your own data, in the absence of that, we will use our own data from Unity services that you have agreed to integrate into your project, and readily available external data.

> Does the Unity Runtime phone home by default?

> It does not, unless you have hardware stats enabled.

----

I'm not a gamedev nor have ever used Unity to develop something, but those two sections seem conflicting. Can anyone kindly explain how they have their "own data from Unity services" while the runtime does not phone home by default? Thanks!


Unity has way more services than turning on hardware stats. If you use them they can make some estimate of unique users. Unity would now prefer you give them the information yourself.


> Unity would now prefer you give them the information yourself.

I’m sure they’d prefer to capture the data themselves, but they’re now allowing you to self report in order to placate the outrage from the recent announcements.


Thank you so much for clarifying that! It makes sense now. I just wonder if folks are required to use at least one of those services in order for Unity to have at least some kind of information regarding titles sold or something like that.


Missing a feed with actual relevant updates? The old one is still available, just not so pretty.


> VS for mac just looked like a fork of the Xamarin IDE I used to use on Linux w Mono

I second that. And VS for Mac was painfully slow. (I tried it years ago, not sure how it is nowadays)


I only used CLion with CMake... But I'm curious now; would you mind to expand on that lack of support?

Also: https://www.jetbrains.com/help/clion/quick-cmake-tutorial.ht...


Another interesting detail: clicking on substack’s URL on their profile shows a page stating that:

Warning: this link may be unsafe https://substack.com/home

The link you are trying to access has been identified by Twitter or our partners as being potentially spammy or unsafe, in accordance with Twitter’s URL Policy. This link could fall into any of the categories below:

- malicious links that could steal personal information or harm electronic devices

- spammy links that mislead people or disrupt their experience

- violent or misleading content that could lead to real-world harm

- certain categories of content that, if posted directly on Twitter, are a violation of the Twitter Rules


Same! Can't wait to just get rid of it completely. Red Hat also hosted Container Plumbing Days this week and was pretty good! Looking forward to what they will do with Podman (specially on macOS)


To be honest I'm not sure which move was worse: They announcing they would be sunsetting, or they going back on the decision after the backlash. I feel like the trust was already lost after the initial decision; there's no going back after that.


You forgot the part in the middle where they tried to gaslight everyone about what kind of sunset was announced.


Beautifully executed! Really liked the concept, just bookmarked it! ♥


Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: