News for hackers. Stuff that matters.
Re:FastDoubleParser: Java port of Daniel Lemires fast_double... by mabbo on Monday March 22, 2021 @01:03PM (#26543519)
The real question is why C/C++ programmers accept code like that. You can write that same code in an easier-to-follow way, and the compiler will turn it into an identical binary.

Code should be written for humans.

Re:FastDoubleParser: Java port of Daniel Lemires fast_double... by pjmlp on Monday March 22, 2021 @02:05PM (#26544376)
Frameworks produced by Windows dev team are a very good example of that.

They could produce something that looks like Qt, OWL/VCL, or nowadays .NET like but in C++.

Instead they produce libraries where one is forced to use C low level details, mixed with Win32 and COM pointer handling and casts everywhere, not even MFC escapes it.

Not to count how many interactions of COM smart pointers that have come up with since COM exists.

C++/CX looked like they finally learned their way and would offer something similar to C++ Builder, but no that wasn't meant for us to enjoy it.

So now anyone doing UWP with C++, gets to manually edit IDL files without tooling support, and merge the generated files manually.

I really don't get their macho developer culture.

Re:FastDoubleParser: Java port of Daniel Lemires fast_double... by nyanpasu64 on Tuesday March 23, 2021 @12:47AM (#26551239)
According to Steven Sinofsky, MFC being a thin wrapper around the underlying MFC was a deliberate design decision during its development. https://hardcoresoftware.learningbyshipping.com/p/010-our-bi...

In retrospect, do you feel it was it a bad idea to not use a heavier abstraction?

Re:FastDoubleParser: Java port of Daniel Lemires fast_double... by pjmlp on Tuesday March 23, 2021 @03:13AM (#26551976)
I am aware of it, hence my remark.

It was a bad idea versus what other compiler vendors had in their toolbox.

MFC only won because Microsoft is the OS vendor, and Borland lost it trying to fly too high.

Back in the MS-DOS and Windows 3.x very few would use Microsoft compilers, Borland and Watcom were the favourite.

Re:FastDoubleParser: Java port of Daniel Lemires fast_double... by dmos62 on Monday March 22, 2021 @06:11PM (#26547998)
> I really don't get their macho developer culture.

I'm inclined to not recognize that as a distinct culture and rather call it an infectious habit. Auditable, maintainable code is a skill, after all.

Re:FastDoubleParser: Java port of Daniel Lemires fast_double... by ghanrt on Monday March 22, 2021 @02:15PM (#26544542)
It is. Apart from ++index, this is literally the same as:

  let ch = if index < strlen then str.charAt(index) else 0
Eminently readable and less boring than long if/else chains in Python.
Re:FastDoubleParser: Java port of Daniel Lemires fast_double... by dmos62 on Monday March 22, 2021 @06:19PM (#26548097)
It's not. To be easily human-parsable you want to do one thing at a time. It's that incrementation that you've ommited that messes things up.

On a side note, having gotten used to newer languages, an option type sure is a nice thing.

Re:FastDoubleParser: Java port of Daniel Lemires fast_double... by Twirrim on Monday March 22, 2021 @05:36PM (#26547504)
You can write in a very similar way in python too if you want to. I think I'd argue this is cleaner syntax, even.

    >>> foo = 10
    >>> bar = foo if foo > 5 else 0
    >>> bar
    10
    >>> bar = foo if foo < 5 else 0
    >>> bar
    0
Re:FastDoubleParser: Java port of Daniel Lemires fast_double... by jldugger on Tuesday March 23, 2021 @12:40AM (#26551197)
IDK,

"for ch in index:"

reads pretty cleanly to me.

Re:FastDoubleParser: Java port of Daniel Lemires fast_double... by lmm on Monday March 22, 2021 @09:35PM (#26549927)
People who care about correctness wouldn't be using C/C++ in the first place. The culture of those languages is performance above all else, and it only gets worse as more and more "moderates" move to memory-safe languages, leaving only the extremists left.
Re:FastDoubleParser: Java port of Daniel Lemires fast_double... by naikrovek on Monday March 22, 2021 @09:38PM (#26549947)
That is not an informed opinion at all. The C++ people I know ALL care about correctness... That's why they use C++. They want to make sure it's done correctly, and not left to some node package that barely works.