numbers, trivial observation
@amiloradovsky@functional.cafe technically, while addressable, the entire space might not be representable with an N bit address either. In general you would want to specify/represent it with a range, which would be two numbers, beginning and the end. In this case we can fix the beginning as 0 inclusive, and use an N bit number to represent the end, but this is still not enough, need one more bit to specify whether the endpoint is included or not
[0,N?
If, as with 0, you decide it's always inclusded - can't represent the empty range [0,0), and otherwise - the longest representable range [0,2^N-1) would be of length 2^N-1. Not willing to spare a bit, the latter is what people usually end up with, since the empty range is much more useful, than one extra memory slot. Then the same N bit number is then enough to represent the length of any representable range, without being counter-intuitive.
TL;DR - It's just a question of whether you want the empty range or the full (2^N element) range to be representable in general, address or length, ordinal or cardinal, it's the same.
Sidenote: address 0 is not arbitrary, if it was arbitrary, I would have had to specify it and use whopping 2N bits for my range representation in this trivial example. I do enough of that in real code, so thank you precious 0 for saving me the trouble.
compiler bugs, will they ever stop harassing me?
aka another reason to never use built-in arithmetic types.
@iooioio
C is low level in a sense that the language itself lacks facilities for user defined abstractions, so you have to push your abstractions out of the language and into the runtime. For a large project in the long term these abstractions matter much more than the language, and there are plenty of existing code you can borrow from.
The lack of language level support also gives a specific flavor to C abstractions, they are very opaque - the language will not help you to recognize/understand them, and very general - once you finally manages to get a good abstraction, you tend to want to use it for absolutely everything you can, since it was hard work to get it.
I made a reference counter, so now everything is reference counted! I made a file system abstraction, so now "everything is a file"! I made process manager/scheduler so now "everything is a process"! etc.
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!
@academicalnerd and I rant back, don't take it too seriously yourself, student, hmph!
You are now talking about lack of experience, which is far from the initial "most people just can't math". Not everyone is a linguist or a writer or a plumber or a baker either, cause not everyone wants to be. Nothing oh so special about mathematics there. Most everyone speaks a language however, and most everyone these days can multiply large numbers, and while there is always debate on the meaning of the simplest words and phrases, I don't think I ever saw anyone debate on a result of a multiplication.
@academicalnerd how the hell do you misinterpret that quote so freaking badly? Who do you think you explaining it to? Yourself? Explanation implies that you are doing it to someone else, anyone else. Mathematics is not about describing the universe, that's physics, mathematics is about communication. It's the universal language, not by coincidence, but by definition. Any mathematics that is somehow inherently inaccessible to anyone honestly willing to learn is failed mathematics, and any mathematician who practices that is a failed mathematician. The whole point of mathematics is to maximize understanding in communication, and in the context that you bring up - to prove fluency. Meanwhile fluency in natural languages is fuzzy at best, since it's a natural phenomenon and is studied as such.
@L29Ah Power 9 is your best bet as far as I know, though they're still not going to make it easy I imagine:
https://openpowerfoundation.org/
Talos 2 is an example of high end Power 9 servers and desktops
https://www.raptorcs.com/TALOSII/
and they have a wiki that might be of some help, I dunno
https://wiki.raptorcs.com/wiki/Category:Documentation
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 -_-
#cpp
- 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.
@timorl @bonifartius you are going to single handedly steal a substantial portion the shop's stock and then do what with it? That wouldn't be stealing that would be destroying. Vandalism! Otherwise if the majority if people who can make use of the product are in on your plan, you don't have to steal either, just don't get in at all.
But don't fret my cultured robber fiend, there may be use for your skill in this important struggle - instead of freeing it up, clog the chain! Steal from people who buy it and sell it back to the shop for half the price, make sure it stays on the shelves until it expires. Shops will love you and the production will halt.
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.
#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 🔗️: https://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.
but now it look a lot more like the cppreference example implementation... so much for trying to be original and stylish...
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 -_-
so since we don't have a proper search till c++20:
http://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.
@pleb it's not casting in this case, it's promotion. how does promoting bool & bool to an int help compatibility with C? In fact because of the implicit casts you don't need to promote.
I want to pass bools to a generic function that uses logical bit operation and get back a bool, instead I get back an int for no reason. A freaking int not even unsigned, and until c++20 it's implementation defined what happens to a signed integer when you bit twiddle it.