Show newer

my brain on c++:
spends hours on an elaborate meta programming to implement private friend functions with perfect forwarding, only to realize that it's solving the wrong problem and all it actually needed was a const member function...

this is why your math-scientific always canonical pure algebra implementation doesn't cut it, rationals have much wider scope - to keep track of and delay division until it's convenient/necessary

Show thread

a fixed point number is just an optimization of a rational with fixed denominator

wasted hours patching it up before learning to read and finding it alive and kicking on github, no more auto_ptr, still a mess in general, but doesn't segfault quite as often as the ancient release

Show thread

compiler bugs, will they ever stop harassing me?

ix.io/3pji/cpp

aka another reason to never use built-in arithmetic types.

Look at me ma, my library is going to have a matrix type, a row vector type and a column vector type, isn't that wonderful? I read a math book. I study math I'm so smart ^-^

-_-
o_o
O_O
O-O
O^O
>0< NOOOOO!

>.<
>0< ROW VECTOR IS JUST A VECTOR!
(>-.-)>
vector(1,2,3)

>.<
>0< MATRIX IS JUST A VECTOR!
(>-.-)>
vector
(
vector(1,2,3),
vector(4,5,6),
vector(7,8,9)
)

>.<
>0< COLUMN VECTOR IS JUST A VECTOR!
(>-.-)>
vector
(
vector(1),
vector(2),
vector(3)
)

>0< VECTOOOOOOORRRR!

2's complement representation of negative integers follows directly from the definition of basic addition, stop teaching it as if it's some special clever bit twiddling scheme. The most significant bit is not the sign bit, and you do not convert between negative and positive by flipping the bits and adding 1, what bizzaro world do you exist in?

Undefined behaviour means "if you do this, anything may happen", and even though you most certainly shouldn't do it, it doesn't mean "don't do this", hence if you actually define it to something specific, you create a subset and not a superset of the programming language.

clang is infinite looping and/or crashing on me again -_-

- hello, library that handles X, I would like to do the most obvious thing one would ever want to do in context of X, could you tell me how, please?
- ah yes, of course, our library could never work for X without handling such fundamental problems... however our API is shit, so just look at these internal implementation details, copy them into your project, and integrate them with the API yourself. Keep in mind though the API is parametrized on all the wrong things for no reason, so you'll have to do it in the most backwards ways.

Show thread

JUCE framework is a freakin joke. Here I thought it's a comprehensive toolkit for low level audio programming, but turns out it's a useless Qt wannabe.

You know what's important for audio programming? Threads. Can you please thread safety, a framework that takes away my main() and handles GUI with a custom freakin build system? No? Apparently that's fine because 32 bits ops are atomic on x86, hurr durr. Also the only sample type is float, cause you know C++ is known for no generic code whatsoever, none, not a part of the language, never been. Wanna playback a standard pcm data from memory? How about a backwards file stream API that has a specialization to read from memory, and a audio callback that is going to convert it to float regardless of what it is and what the sound hardware supports? And don't forget to bring your own ring buffer, pleb. If you don't have one go to our community forum, where you will be told to git gud.

namark boosted

#cpphttplib is a #singleheader #HTTP client and server #library for #Cpp.

cpp-httplib implements HTTP client and server functionality with a straightforward interface. Starting a server is as simple as defining an action for a specified path and listening on a port. Server paths support regexes for more complex behaviour. cpp-httplib supports #HTTPS and quick static file serving.

Website 🔗️: github.com/yhirose/cpp-httplib

#free #opensource #foss #fossmendations #programming #networking

ergonomics > safety guarantees

It is very much possible for you to fall when sweeping the floor, but how often do you? Or feel the need to lean against a wall? If cleaning the roof is made just as convenient, with a bit of diligence you wouldn't fall from it either. Neither would you poke your eye with a soldering iron, or drill into your own scull, not because it's impossible, but because the tools are easy for you to use properly. Instead of trying to build sophisticated all encompassing systems that allow you to ignore real problems, learn to tackle those problems comfortably and develop tools that make the solutions obvious.

fixed
ix.io/3nAq/cpp

but now it look a lot more like the cppreference example implementation... so much for trying to be original and stylish...

Show thread

of course I notice a horrible out of bound read right after positng -_-

but it passed the tests, even with address sanitizer :v

because tests were on c-strings that and null terminators saved them -_-

Show thread

so since we don't have a proper search till c++20:
ix.io/3nAa/cpp
gotta love the do-if-while.

shame ix.io html doesn't highlight the if though, so maybe
curl ix.io/3nAa+cpp
instead.

the rage type is just a simple aggregate that holds the two iterators and provides the usual begin-end interface, no magic there.

why do bit operations on bool return an int? doesn't that defeat the whole point of bool? do I have to redefine every single fundamental type to not be insane?!

stlab.cc/2020/12/01/forest-int
it's like beads on a string, so lets call it... a forest... of course... following in the footsteps of std::vector -_-

Show older
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.