News for hackers. Stuff that matters.
Re:How to Write Portable C Without Complicating Your Build by newhouseb on Friday March 31, 2017 @07:03AM (#14002616)
One of the nice (perhaps underappreciated) side effects of Rust has been first-class support for all major platforms. If you're linking against other Windows bits you still need to think about mingw vs. msvc, but beyond that you don't need to customize/hack up a build system to get things compiling sanely on both. I recently switched back to C for a particular project and there's been quite a bit of reverse-culture shock when it comes to setting up builds & projects.
Re:How to Write Portable C Without Complicating Your Build by pjmlp on Friday March 31, 2017 @07:09AM (#14002643)
Rust still doesn't have first class support for UWP.
Re:How to Write Portable C Without Complicating Your Build by sqeaky on Friday March 31, 2017 @01:20PM (#14005943)
UWP?

EDIT - I should clarify. I google UWP and it could be Universal Windows Platform. If so, how is that different than the windows builds that Rust does support?

Re:How to Write Portable C Without Complicating Your Build by pjmlp on Friday March 31, 2017 @03:08PM (#14007097)
Think of UWP as Windows Longhorn reborn.

It is the same programming model as .NET, but built on top of COM and just the minimal set of Win32 APIs to support COM based APIs.

It is also sandboxed, just like on OS X.

For Rust to support UWP, it needs to be able to consume COM with the new UWP semantics and at the same time expose traits as COM interfaces accessible to any programming language able to consume UWP libraries.

Re:How to Write Portable C Without Complicating Your Build by sqeaky on Friday March 31, 2017 @03:44PM (#14007424)
That doesn't sound like a good idea at all, any of it. Why is microsoft doing this?
Re:How to Write Portable C Without Complicating Your Build by inferiorhuman on Friday March 31, 2017 @03:55PM (#14007533)
Rust is pretty nice if a bit rough with the cross compilation stuff. The big problem is speed. Compiling rust projects takes a while and some operations like reading a file line b line are absolutely glacial.
Re:How to Write Portable C Without Complicating Your Build by steveklabnik on Friday March 31, 2017 @04:16PM (#14007742)
Are you using a BufReader for those file reads? If not, system calls will slow you way down.
Re:How to Write Portable C Without Complicating Your Build by inferiorhuman on Saturday April 01, 2017 @09:01PM (#14015096)
Yep. And it's something of a known issue. Using BufReader#lines is glacial (and something of a known issue) in debug mode and merely slow in release mode. My understanding is that the BufReader is allocating a new String object for each line and so you're dealing with strict UTF-8 parsing and memory allocation.

My use case here is reading Vyatta config files. So lots of files that are generally (but not always) short. Mostly it's a fun teach myself Rust project, and it's hit lots of interesting edge cases in Rust, but otherwise I'd be all over just writing it in Python or Ruby.

Re:How to Write Portable C Without Complicating Your Build by steveklabnik on Saturday April 01, 2017 @10:26PM (#14015415)
Interesting, I did not know this.
Re:How to Write Portable C Without Complicating Your Build by inferiorhuman on Monday April 03, 2017 @10:03PM (#14028965)