« first day (2985 days earlier)      last day (1954 days later) » 

12:04 AM
@Mysticial In case you're interested, I found a use-case for AVX512VBMI vpmultishiftqb: converting an integer to ASCII hex, you want to grab 8 nibbles, and put each in the bottom of its own byte. IDK if you've figured this instruction out since we last talked about weir'd / hard-to-understand AVX512 instructions, but it just selects 8 unaligned windows of 8 bits from the source. It's a parallel bitfield extract.
Tested/working use-case in stackoverflow.com/questions/53823756/… (How to convert a number to hex?), a canonical Q&A I just wrote up.
 
 
3 hours later…
2:52 AM
@Borgleader gcc -O3 enables auto-vectorization, unlike -O2, and thus can help a lot for some problems. (clang enables auto-vectorization even with only -O2. I'm not sure what clang's -O3 does beyond its -O2, but with code that pointlessly copies from a std::vector<int> to a C99-style variable-length array with std::copy, this code needs all the optimization it can get. The default optimization level for gcc and clang is -O0 (short compile times, terrible anti-optimized code-gen.
@towc (VLAs in C++ are a GNU extension).
 
 
1 hour later…
4:04 AM
Even if you are an animal, make sure you are born in a right country. Take neighbourhood possum for example, little bastard gets to live from one neighbourhood garage to another, stealing fresh fruits and vegetables in the local area (because a few household here have vegetable patches and fruit trees in the backyard). No danger of being making into a possum glove.
 
5:04 AM
 
 
2 hours later…
7:09 AM
I thought the two biggest external threats facing our economy were Donald and Trump.
Double dipping, you are doing it right.
Reading comments can be entertaining, although one must find articles that tend to attract highly intelligent readers.
 
7:47 AM
hi
does anyone develop with C++ on Windows or do most people do it under Linux?
 
Depends on what you are doing with C++, it can be on windows or linux.
Windows are mostly on gui, linux mostly for backend - that's my understanding.
 
8:06 AM
Your browser was written in C++
 
8:22 AM
So, our Czech cyber security bureau warned about ZTE and Huawei software and hardware. Telcos will have to replace their routers and such.
 
8:57 AM
Also, it is hard to get from an idea to actual working application.
I get stuck on technicalities.
And GUI is hard.
 
9:08 AM
You know why programming (GUI, backend etc) is hard? Because we don't have enough geniuses to provide us with framework that makes it easy.
It's easy to provide complex solutions to complicated problems, very hard to provide easy ones.
lol, that intro ...
 
9:25 AM
@TelKitty lol, where is this from?
 
More info here ... someone from the same bushwalking group.
 
10:27 AM
@wilx I've been getting paid to make GUIs for a few years (among other things), still have no clue how to write tests for user interaction.
 
@Mikhail I dislike Web UIs but that is one thing that is possible with them.
 
So, it is possible to write a script to press the buttons, but its not clear if this is the right way. Its also possible to write a script that will press random stuff, which I heard was good for catching race conditions.
 
nwp
Why would that expose race-conditions? GUIs have a message queue that serializes events, so there is nothing that can race besides the message queue.
 
10:43 AM
Yeah, but they might communicate to something that doesn't.
 
@nwp You can also have multiple windows in single application each being served by different threads.
 
nwp
I only know of the WinAPI that supports that. Everything else doesn't.
 
@Mikhail don't, it's cheaper that way :p
 
nwp
11:00 AM
Why are templated lambdas C++20? I actually found a use case.
 
@Mikhail how else would you suggest to do it?
@PeterCordes isn't array access faster than vector access? I didn't think it was pointless
 
I don't know, much like how N==NP, it is one of the unsolved problems in CS
 
@nwp they've also been a GNU extension for some time IIRC
 
@towc it's not
also wtf who opened the rift to the js room
 
Templated lambdas are mostly good when you don't want to sprinkle decltype everywhere
I don't know of other use cases
 
11:02 AM
@BartekBanachewicz my nation is under attack. We seek shelter in other rooms
 
Finding shelter in dead rooms, smart
 
nobody thinks about bombing graveyards
I hope
that would be extremely sick
 
you haven't watched enough zombie movies
 
nwp
I have a insert_item lambda for a QTableWidget that sets fonts and flags and stuff. And now I need it to not make a QTableWidgetItem but something derived from that for sorting. A template with default parameter seemed reasonable.
 
yay, I knew people would soon find ways to abuse C++20 features
 
nwp
11:15 AM
It's totally reasonable and not at all abuse QQ
Say "abuse" and a smurf appears. Coincidence?
 
@Mikhail is that what people normally do in production?
 
People do use mmap in production when they need speed and when it actually makes things noticeably faster
 
but call it std::mmap
But, yes, mmap is the way some of the coreutils are written, which is probably production. Its also C.
 
ssssshhh, you're about to invoke Niall Douglas
 
Remember that boost allocator that leaks memory with a C++ interface :-)
 
11:24 AM
which one?
I never used Boost allocators
actually the only allocator I used outside of std::allocator is libstdc++'s bitmap_allocator :p
 
nwp
11:40 AM
QVector<double>.resize(3273415) throws. Why? That's only like 24MB.
And it's not my fault this time for using QVector. It's my fault for using a graph widget that wants a QVector.
And try{} catch (const std::exception &e) doesn't catch it -.-
Time for pokemon exception handling.
 
@nwp weird
 
12:00 PM
QualityVector
 
12:29 PM
would be interesting to have a g++ preprocessor option to make the code camel/snake-case independent
coming from js, a lot of code samples would be much less overwhelming
 
@towc impossible
@towc irrelevant. It's just name casing
adapt and move on
 
@BartekBanachewicz you're underestimating my ability to get overwhelmed
 
@towc learning other languages is a great way to deal with that
after 20 languages the 21st gets easier
 
it's just about visual noise. I can understand it if I read more into it, but right now, most code samples look like gibberish at first
 
@towc frankly switching from Haskell code to anything else it all looks noisy as hell
parens are the worst
 
12:32 PM
I'm not sure visual noise should be an obstacle in any scenario
but then again, I don't mind my semicolons
 
I specifically hate parens because editing them is a huge pain
@towc useless
generally I like whitespace-sensitive languages in that regard
but alas python still requires parens for a function call
how much more beautiful is f x than f(x)
 
I don't like how meaningful indentation is in python
I want to have a bit more wiggle room
 
@BartekBanachewicz what if the 21st is C++
 
and one-liners, sometimes
 
@Morwenn still better than if it was 1st
@towc so that's where Haskell comes in again :) whitespace-sensitive by default, terse one-line syntax when you want/need it
 
12:35 PM
I never managed to properly understand Rebol scoping rules
@towc I love how it's meaningful tbh
 
@BartekBanachewicz right, I do think haskell does it well
 
I know this is soooo far away on the priority list but Haskell's syntax, after all those years, is spot on for me
 
haskell programmers can be very messy though, so code samples are often not much better
 
@towc and incidentally python controls that better
because it's more strict in its indentation rules etc.
 
right :/
 
12:36 PM
so you immediately see the tradeoff
 
nwp
@towc There is a fix for that.
 
I do like to write messy code every once in a while, so there's that
 
I think the one thing the PL shouldn't allow you to be messy is program correctness
but honestly, textual representation? whatever
 
@BartekBanachewicz and that's how you get ants
 
program correctness is for ubi-correct machines
source looks are for fleshy imperfect humans
you see what I'm getting at
I mean by all means still do enforce style with tools
 
12:38 PM
oh wait, I thought you meant the opposite
I agree, the PL shouldn't try to be strict on textual representation
 
I mean if you don't enforce style by tools then basically you're relying on dev discipline
but then again the style is just for developers themselves
it's not like the code style impacts the product in any way whatsoever
 
wait, so you also agree that the answer to "should there be a way to make c++ camel/snake-case insensitive" is "uhm, what the hell, might as well"?
 
@towc If anything, "customizable" rather than "insensitive" I suppose
and for this specific case I am not sure if it would be doable/practical
 
well, the rest would be enforced by style guides
 
also, the language doesn't disallow camelCase
 
12:44 PM
@BartekBanachewicz why not? I'm genuinely asking, I don't know much about this langauge
 
in fact, all of my C++ code is camelCase
 
@BartekBanachewicz what gets me is seeing a mixture of them at an almost even split, with no particular added semantic meaning
 
@towc it's just how names are treated and constructed and there are constructs that create names during e.g. preprocessing and there's code that would clash
 
all of my C++ code is snake_case
 
@towc typically it's gonna be camelCase for my code and snake_case for std
 
12:45 PM
but it mostly ended up like that because I wrote stuff somewhat mimicking the standard library
 
^
all of our C++ projects at work are also camelCase
 
@BartekBanachewicz is that semantic at all?
it's a distinction about where things come from, sure
 
also because I do much snake_case with Python (the exception being when I use PyQt)
 
nwp
Bjarne_case :D
 
>.>
 
12:46 PM
but you have other more consistent ways of knowing that
 
@nwp plz
@towc sure, so it's mostly the case of "the language allows me to do that so I do that because that's what I prefer"
I explicitly qualify all names from std:: anyway
in a way it does make it stand out regardless
 
right, it makes something that shouldn't stand out, stand out
 
nwp
Why should it not stand out?
 
@towc also in our code at work there's a lot of type aliases introduced
so e.g. using OurObjects = vector<OurObject>;
 
@nwp there's things that should stand out more
 
12:48 PM
this clears up the syntax, but admittedly I don't really like it
 
for example, in most cases, I think the name of variables should stand out more than the types
 
I prefer the standard collections to actually be visible outright
@towc what?
that's the default scheme btw :)
and it makes a lot of sense, sice the names are waaaaay less relevant than types
 
well, I guess I disagree with that scheme
 
I use Code::Blocks so colours are irrelevant because it sucks anyway
 
@BartekBanachewicz how often do you see types in haskell?
 
12:50 PM
@towc I use a lot of single-letter variable names
 
you do, but they're not what the fuss is about (types in haskell)
 
@towc erm?
> types are not what the fuss is about in Haskell
that's a rather brave statement tbh
I'd say types are like 90% of the fuss there
 
the function names are what's important
 
absolutely not
 
what the function does
 
12:51 PM
what the function does can often be inferred from the signature
e.g. id :: a -> a has only one possible implementation
 
nwp
@BartekBanachewicz Why can this not have increment behavior?
 
@nwp what's "increment" (e.g. for a custom type)?
 
nwp
return a + 1;
 
that only works with numbers, i.e. members of Num
 
well, consider the common char** args. The fact that this contains args is much more important to me than that it's a pointer to a pointer of chars
 
nwp
12:53 PM
Maybe with some SFINAE-equivalent that only does it if that compiles.
 
@nwp Haskell has no SFINAE; if you use a concept, you must be explicit about it
well or let the compiler infer it, either way
 
nwp
rip
 
std::unique_ptr<int> p1: I'm not really bothered by the fact that it's a unique_ptr. In some cases, that's really useful, in others, it's not, and I don't want it shoved down my throat
 
@towc that's what the type aliases are for
@towc without that knowledge, you have absolutely no idea how to use your p1; consider
 
@BartekBanachewicz a significant type name stands out less than a more gibberish one, and that's how it should be
 
12:55 PM
void towc(auto p) {
   // please print p + 1 here
}
 
@BartekBanachewicz I'm not saying to take it out, I'm just saying to put focus away from it
 
@towc but that's a completely wrong goal
you should focus on the types first
 
when creating a class, do you group field names by type, or by semantic meaning?
 
irrelevant
mostly alphabetically
 
I can't stand people who group them by type
alphabetically kind of makes sense, I guess
but I tend to do it semantically
 
12:57 PM
that's what the code completion does anyway
 
and more often than not, that's based on the name alone, not the type
 
that still doesn't mean you shouldn't focus on the types
want a fancy example?
 
ok, let me rephrase. You should be able to focus on the types, only when you want to focus on the types
there should definitely usually be a simple way of telling what the type of something is
but again, it shouldn't be yelled at you
 
imagine you have two lists, [a] and [b], and want to turn them into one list of pairs [(a,b)]. You have no idea how the function is called, but you know what you want to do; so you type it in and voila.
@towc I completely disagree. In fact, the best names are the ones that aren't needed at all
anyway BBL meeting
 
sure, and again, I'm not saying types should be forgotten about
 
1:04 PM
@towc Depends on the type. I prefer to do so by semantics, even grouping them in structs if a group has a specific meaning. However, for performance critical code, I'll go with the size of the type, to reduce padding as much as possible.
 
1:38 PM
@JVApen apparently new CPUs don't care about alignment anymore and we can all just tightly pack our structs
 
@BartekBanachewicz ummm depends on the architecture. Most RISC systems care a TON
 
@Mgetz I meant the big systems, x64
 
@BartekBanachewicz x64 overall marketshare is dropping. The big three (Google, Microsoft, Amazon) are spinning their own CPUs based on RISC systems.
 
@Mgetz [citation needed]
for MS that would be E2 I guess
 
1:44 PM
@BartekBanachewicz Do you have proof for that?
 
@Mgetz interesting
 
@BartekBanachewicz I know MS and Google have announced they are going that direction but I'm too lazy to find the articles
I'm not sure if they've deployed any generally yet
It doesn't look like google has
 
@Mgetz This is an indication related to Google: phoronix.com/…
 
> The restrictions on data alignment have been slightly eased in the Itanium processor, relative to the Itanium processor, if the proper flags are set in code. (Check your manuals for the exact settings.) The relevant section from Intel® Itanium® Processor Reference Manual (Section 5.5) states: "The Itanium processor implementation supports arbitrary load and store accesses except for integer accesses that cross eight-byte boundaries and any accesses that cross 16-byte boundaries."
generally you'd need to do a bit of digging
 
Honestly even on machines that do support non-aligned access that doesn't mean it's not faster to be aligned
 
1:48 PM
tightly packed structs can potentially utilize cache better, though
 
@BartekBanachewicz I'm not saying not to optimize layouts of structs, I'm just saying that overly compacting them may not be beneficial either. Particularly if it causes them to consistently cross cache lines
 
I'd rather have a struct fit either wholly within a cache line, or align to a cache line
 
@BartekBanachewicz Your source: software.intel.com/en-us/articles/…
It also states nicely: "Misaligned objects cause program exceptions. For an item to be aligned properly, it must fulfill the requirements imposed by 64-bit Intel architecture (discussed shortly), plus those of the linker used to build the application."
 
Always measure.
 
1:54 PM
"It is recommended that all structures larger than 16 bytes align on 16-byte boundaries. In general, for the best performance, align data as follows:"
So, from what I read, packing is still dangerous and you really need to do your own tests before applying it on all code. I'm gonna continue looking into this. Tnx
 
@JVApen I would suggest packing via the normal alignment mechanisms first, without using compiler hacks
just the order of struct members can make a huge difference
 
@Mgetz Thats what I'm doing now, unfortunately, its hard to maintain with a lot of developers
 
nwp
Maybe one day I will see performance-relevant code. Somehow so far I didn't.
 
@nwp every code that suddenly is too slow is performance-relevant
every game update loop that takes over 16ms is performance-relevant
 
Agreed, and once you are working on applications taking Gigabytes of memory, you care about using less memory
 
nwp
2:02 PM
Yeah, I guess it depends on the definition of performance-sensitive. It did happen that I accidentally copied a lot of vectors and had to add a & to fix it, but never have I needed to profile or benchmark my code. And I was told if you don't do that you don't really care about performance.
 
@JVApen embedded?
 
No, big servers
 
@JVApen use static code analysis then, you can create a custom pragma to flag it that the compilers will ignore
or an attribute
but if that definition crosses library boundaries at all you could have bincompat issues
 
:) For sure, 20-80 applies everywhere.
 
That said static code analysis is the way to go in general, would not be surprised if google already had a tool for this in the chromium code base.
 
2:11 PM
Worth checking out, haven't found it yet in clang-tidy
Some more interesting reads: lemire.me/blog/2012/05/31/…
 
2:31 PM
god damn it, 'I hate hats' doesn't work in chat :(
 
nwp
@thecoshman It does for me.
 
so @thecoshman how is PIR-8 going
 
@BartekBanachewicz <cough> hey what, erm, did you see that over there?
 
who might have thought
 
2:37 PM
:D
 
I had another urge to write some C++ today
I'm waiting for it to pass
 
I still want to make it, and to make it at the stupidly low level that I want to
 
I was thinking about getting back to Minicraft and maybe getting it to build and stuff
@thecoshman I have just actually finished a hardware project
so I'm in this delightful limbo where I can theoretically start working on anything else
 
but I think I might look into first making it via an FPGA that I can test works. I can then look to rip parts out into real hardware
 
you don't need an FPGA
 
2:38 PM
But I also want to play with a six legged robot walk :P
What's the project?
 
@thecoshman DIY Wiral cam thing
 
@BartekBanachewicz wiral cam?
 
I made a remote-controlled engine controller
 
huh, nice
 
I don't have the chassis yet but that's for my other team-members rn
I mean it's not like done done, I expect to modify the circuit a bit, but it's good enough for initial testing
 
2:40 PM
@BartekBanachewicz well, I could make it out of someting like 74 series chips... is that what you mean?
 
@thecoshman I'd start with a MCU with a lot of pins
and then yeah potentially simple shift registers etc
I was actually curious about some tiny mcus that have 0 bytes of RAM
I suppose they still get registers, so I could hook up to an external RAM module
that's sorta like a real-ish computer
I also bought some 1MB flash memory chips recently, and was wondering if I could put code on them
 
Yeah... but if the idea is to make my own cpu that's implementing my own instruction set... how does using another mcu help?
I mean, it could help with interacting with it sure
 
@thecoshman well you can implement it as a simulator first, no?
the chip can provide the physical layer basically
so instead of running a simulator completely virtually on a desktop you can run it on an MCU and interface real hardware
 
Yeah, but using an FPGA can help me make sure I've got my hardware design 'right'
 
@thecoshman well yes but it's much easier to program an MCU to simulate an arch than to program an FPGA to do it I think
 
2:45 PM
I think I should sort out a proper software simulator any way, which was something cat was looking at, so I might look to get that working
 
yeah but what he did was targetting desktops
and what I meant was more of a translation layer
 
Yeah, but it would help with debugging code
and FPGA would work to better test my hardware design
 
well you'd definitely need it as well
@thecoshman of course it also won't tell you about any hidden hw issues
 
whilst using a micro controller to run a simulation of it has issues with having to simulate hardware aspects
@BartekBanachewicz no, but it will help with that a lot more than simulated cpu
 
are you sure, though?
in the end it's gonna interface the same logical units that are hardware-ish
the FPGA would mainly be faster (and harder to develop for)
 
2:47 PM
I think there's still some more things I could do with thinking through though really
like how to interact with the system
 
I'm kinda eager to build something with separate components, but ofc without the hilarity of my own arch
just having separate RAM and ROM would be interesting enough I think
@thecoshman what do you mean?
 
well, for a very early version, I could just manually toggle data into the ram (iow using something that can automatically write data into the ram for me) and then just trigger the CPU to reset it's internal state and start working through
like a very early days computer
 
@thecoshman yeah like the altair 8800
that's actually surprisingly usable
 
the output would just be a case of reading the ram, so maybe some additional hooked up to certain ram address or registers to make reading their value easier
 
you could have separate bootstrapping bios or something basically
 
2:53 PM
Yeah, I'd basically use a raspberry pi as a bootstrap system to load stuff into ram and start the computer off on it's way
 
so in the end it's nothing that fancy
it's how the existing machines work
 
not really no
 
@thecoshman yes when you consider small mcus
 
3:12 PM
Two big advantages to using an FPGA for the simulation is that one, I get to being all smug that I am now a professional FPGA developer and two, it's not C :P
 
@thecoshman lol do you really think programming FPGAs is gonna be better than C
also MCUs are programmed in C++ not C mostly
 
depends on the mcu vOv
it's been a while since I've done much with them, but yeah, Arduino is probably what I'd end up with
just because low barrier to entry
 
@thecoshman not really? even the smaller ones you can program in C++ just fine
@thecoshman Arduino is a library than can run on a lot of chips BTW
 
yeah, it's quite nice for that
 
I mean there are Arduinos the boards and there's Arduino the library
 
3:17 PM
sure
 
3:33 PM
well, here's one way to remove visual noise: github.com/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee/…
 
heh saw that
 
4:14 PM
@PeterCordes Oh nice. I've only lightly studied that instruction. Haven't really tried to use it yet.
 
 
1 hour later…
5:16 PM
@towc std::vector has an extra level of indirection, but inside a loop the compiler can normally hoist that out of the loop, and doesn't need to reload the start-of-data pointer from the control block every iteration. vector::operator[] doesn't do bounds checking (at least when optimization is enabled), so it will compile to basically the same asm.
A std::vector is usually class vector<T> { T *base, *end, *allocated; } with some member functions, so after inlining it just boils down to indexing relative to a pointer.
 
5:59 PM
oh, neat
so, I wrote what I think is adeguately ok c++ for day 2 of AoC : gist.github.com/towc/618dba03c91ea46fdde3c554f86f64df
anything wrong with that?
I bet there's some nice ways to do this with more abstractions without losing performance
one way I can think of that I'm kind of scared to get into, is letting one core read the rest of the file in parallel, while calculations are going on
is this the level of detail people usually worry about in the industry?
because in javascript, the care for performance is usually fa
I kind of hope the answer is "it depends", but maybe it doesn't. Maybe if you write c++, it's because your code must move faster than light
oh, also, I guess this is one scenario where the calculations on various lines can be done in parallel anyway
 
 
3 hours later…
9:49 PM
Just asked a question in the C++ Q&A channel. If anyone feels like helping, here's a like to that channel: chat.stackoverflow.com/rooms/116940/c-questions-and-answers
 

« first day (2985 days earlier)      last day (1954 days later) »