« first day (3140 days earlier)      last day (1791 days later) » 

12:39 AM
@Rick Depends on what you're doing. Iterators are mostly just a generalization of pointers to allow generic algorithms to work with any kind of container as long as it defines order to the extent that the concept of "next item" is meaningful, and increment has been defined to get there. But for an array-like collection, a pointer is a perfectly valid iterator.
So basically, if you're writing a generic algorithm, you just about need to use iterators for it to really be generic. If you're not writing a generic algorithm, that's probably more what you should have to justify. Why do you want to write code that could carry out an algorithm on (for example) any linear collection, and instead tightly bind the algorithm to a specific form of collection?
 
1:13 AM
iterators are for job security :-)
cmake gui was a front end that let you choose a compiler and architectures. it worked. Now they decided to remove the architecture which is passed as some kind of flag. The flag is a mystery. Do people get paid to destroy tools that have worked for decades?
Also for Windows they have their names wrong. Says "by default uses Win32" if you want Win32 x64 you pass "x64"
Also still no qt binaries for MSVC 2019
 
1:47 AM
@JerryCoffin I am conflicted about how tight an algorithm should be bound. I am probably wrong about this but the constraint are a property of the data. Shouldn't those constraint be reflected in the algorithm. Like if an array of variable size is required shouldn't that be preallocated as part of the arguments that the method takes. And with all the tool c++ provides like templates there are even more reasons constraints. It just seems like there would be greater clarity of thought
 
@Rick The algorithm is not the function implementing it. An algorithm requires preconditions to be met. This is expressed for a function as typed parameters, and sometimes a well written comment explaining what the function accepts.
@Rick The algorithms requirements cannot be expressed by types alone.
 
A vector as an abstraction just seems like it's built for abuse and over use. It might be that my expectations are not reasonable but it seems like this approach builds carelessness into the system. I haven't found to establish their necessity other than it's nice to have.
@CaptainGiraffe can you elaborate
 
@Rick Lets take binary_search as a simple example. Binary search requires the input array to be sorted, there is no type to express this. (set is not an array)
@Rick binary_search(iterator_where_elements_are_in_order first, stop end);
 
2:08 AM
@CaptainGiraffe that a really good example, but binary search is a tree structure. Nodes more property express it. However, if you were to use an array I don't see how that would make the situation any different. Only in how you serialize it
The modeling is always done in the mind. The implantation is the encapsulation of that model. The types compose that model
 
@Rick The binary search is looking for a tree structure, it doesn't want nor require a tree structure.
"The types compose that model"
> Well put.
 
2:27 AM
@CaptainGiraffe but it seems like it does. If you go to the grocery and ask for an apple and he gives you orange instead. You would say I asked for a fruit and they will say, it's the same thing it contains the same vitamins
* I asked for an 🍎
You need to know the quality and composition you need to be able to identify. The types and the structure tell you about it's quality.
It's commonly accepted that you need to hide implantation details. Maybe the opposite should be true. Maybe it needs to be exposed or expressed in the form of an address or a hash. Keychain seems to be indicating a general movie in that direction.
 
3:30 AM
@Rick Not so. A tree structure can satisfy the constraints required for a binary search, but it's only one of several ways to do so.
 
@nwp Tried without running it as admin didn't work either
 
So I think I've asked this before. Is there some C++ library that can be used for computational workflows that resemble image processing steps, kinda like tensorflow graphs but with the ability to for example output a variable number of elements at each step?
 
3:50 AM
@Mikhail Hmm...seems like Cpp-taskflow would allow that, since you can define the individual steps yourself. github.com/cpp-taskflow/cpp-taskflow
 
 
2 hours later…
user7659542
5:53 AM
Hi

I read the following piece of C code [here](https://vickychijwani.me/simplifying-memory-allocation-in-c/):

#define ALLOC(t,n) (t *) malloc((n)*sizeof(t))
 
user7659542
One of the comments states:
 
user7659542
Another bad thing about this is that you still use the bad practice of sending the type instead of the pointer itself for the size. A proper way to call your macro would be char *s = ALLOC(*s, x)

Here is a simple way to deal with that:
#define ALLOC(p,n) do{ p=malloc(n*sizeof *p); } while(0)

Usage:

int *p;
ALLOC(p, n);
 
user7659542
what is the issue with passing a type? I have always done something like int* foo = malloc(sizeof int); , ie passing a type like that
 
user7659542
Why is it better to pass a pointer rather than the type itself?
 
7:23 AM
Fear, I haz it - when the cashier sneezed a few times. With the same hand as she covered her mouth, she picked up, scanned and packed each food items into a bag. She sneezed some more, then she handed over my bag after giving my change with the said hand.
'Worse come to worst', I thought to myself, 'I will just board that international flight and spread some virus across the globe.'
 
 
2 hours later…
9:01 AM
@Mgetz I seem to recall there was some discussion, but I don't remember any specific paper
And without a proposal you don't really standardize things
 
 
2 hours later…
10:54 AM
@traducerad This macro is garbage anyway
You should be doing int* foo = malloc(sizeof *foo); instead of int* foo = malloc(sizeof(int));, this way you don't repeat yourself, and if you change the type of foo, you don't risk not changing the type inside sizeof, and allocating too small of a buffer
Oh, and you shouldn't be multiplying n * sizeof *foo because integer overflow that happens here will result in buffer overflow vulnerabilities because the allocation succeeded, but the program assumes the buffer is way larger than it actually is. calloc will do a multiplication for you, but there's no equivalent that doesn't zero-allocate, so badlets will keep calling malloc
Yet another reason why no one deserves the fate of writing C in 2019
 
11:09 AM
the C standard library is pretty bad
 
How does int* foo = malloc(sizeof *foo); work? Isn't foo not defined? How much does it allocate?
 
A variable name is accessible starting from its declaration point, which is just before =. sizeof *foo is unevaluated context, so *foo doesn't actually get evaluated, the expression is only used for its type. malloc(sizeof *foo) allocates sizeof(int) bytes because int is the type of *foo
 
12:18 PM
@traducerad just use calloc there are actually potential perf and security benefits and it protects from overflows which that does not
 
user7659542
12:30 PM
@milleniumbug I write C on embedded devices running Linux and VHDL. Stopping to write C would mean there wouldn't be many job opportunities left for me :/
 
@traducerad lol it would actually mean you write safer code. I've seen quite a few embedded shops that use C++ or Rust
 
user7659542
@Mgetz Aircrafts' critical systems still don't run cpp afaik
 
user7659542
not trying to prove you wrong here though
 
@traducerad that doesn't actually make me feel safer, honestly if the mars rovers can run C++ (and they do) then aircraft should be running something safer than C
 
user7659542
@Mgetz which parts of the mars rovers run c++? I presume it is not its critical sw
 
12:33 PM
@traducerad lol actually you're wrong, it's the entire thing
JPL switched to core C++ back with Spirit and Opportunity
 
user7659542
@Mgetz TIL!
 
TIL?
 
user7659542
the thing that worries me a bit is that some pecularities of C and C++ differ quite a lot (don't have an example by hand atm), I don't want to start mixing things between C and cpp. C and VHDL are totally diffferent so there is no way for me to mix things up
 
user7659542
@Mgetz Today I learned
 
@traducerad So IIRC JPL made a 100% switch
they do have very strict rules, but that's because they are operating in insane conditions. So for example they have a custom std::terminate and while they use exceptions they actually are used by the runtime more as a std::terminate and log than exceptions
 
user7659542
12:37 PM
@Mgetz doesn t spaceX still use C rather than cpp?
 
@traducerad no idea, I suspect they probably do because they bought into that myth too
but honestly I'd say that C++ is better and safer for embedded than C could ever be
at a minimum constexpr can do amazing things for you
but If I was going to make a better recommendation I'd say you want to use rust for the most part
 
@traducerad Let me introduce Joint Strike Fighter Air Vehicle C++ Coding Standard by Stroustrup stroustrup.com/JSF-AV-rules.pdf
 
oh right yeah.. JSF and F22 are both C++ too
very strict rules though
 
user7659542
@milleniumbug those are coding standards and thus doesn't actually say which part of the aicraft is in cpp
 
user7659542
maybe the (non-critical) entertainment system...
 
12:41 PM
@traducerad all of it
DoD doesn't allow mixed languages
 
user7659542
One of the big arguments against cpp is that on embedded devices with limited ressources you don't have a clear view of what happens behind the scenes
 
> This coding standards document is intended to help programmers develop code that conforms to safety-critical software principles, i.e., code that does not contain defects that could lead to catastrophic failures resulting in significant harm to individuals and/or equipment.
 
user7659542
while when writing C you don't have this higher abstraction
 
@traducerad lol... that's garbage and FUD
with C++ you know exactly what's happening
 
> JSF++ is for hard-real time and safety-critical applications (flight control software). If a computation takes too long someone may die. For that reason, we have to guarantee response times
 
12:43 PM
I hear that myth all the time and it's wrong
 
user7659542
> Portability: Source code should be portable (i.e. not compiler or linker dependent).
 
user7659542
I ve worked at a couple of companies who obey this rule religiously. But aren't planning to change hardware anytime soon and haven't done so since the company was created
 
user7659542
if you don't change your hardware fundamentally you don't have to change your compiler usually
 
user7659542
you could upgrade your hardware. But to me that doesn t mean you have to switch to a totally different compiler
 
@traducerad I've found most of these companies don't have proper devops and couldn't change if they wanted to. They don't have any compiler or hardware validation
 
user7659542
12:50 PM
what precisely does compiler and hardware validation entail for you? : )
 
user7659542
@Mgetz
 
@traducerad fully automated regression and deployment at a minimum, and A/B hardware to test
 
user7659542
@Mgetz having this doesn't mean you can't use compiler dependent macros
 
one company I saw basically tested every compiler rev doing exactly that, they'd push a stable released set of code through it. Then they'd stress test the hardware for a few weeks of continual use with no downtime to detect subtle errors. Finally they'd take a random dump from one of the modules and look over the memory image for corruption
@traducerad for regulated software you can't
FAA/FDA/FEC don't allow it
 
user7659542
I do believe that some people put too much emphasis on rules like "you shall not use __attribute__((packed))". They havent changed their hw and never will
 
user7659542
12:55 PM
@Mgetz I know large defence contractors who do use compiler dependent stuff
 
user7659542
a lot
 
@traducerad I know the same, and every single time had to get agency signoff and more paperwork than you want to think about
 
user7659542
@milleniumbug wait untill you arrive at a company doing stuff like this: #define STRUCT_CLR(_st_) memset(&_st_, 0, sizeof(_st_))
 
user7659542
Never expected to ever see something like this from professionals
 
user7659542
1:06 PM
written by some dude with more than 10 years of experience
 
1:29 PM
@traducerad let me guess they don't do code review?
or use static code analysis?
 
@traducerad Works fine for PODs, doesn't it? :)
 
user7659542
1:54 PM
@fredoverflow PODs?
 
user7659542
@Mgetz indeed
 
@traducerad lol, and we fly on these aircraft... wow we are so screwed
 
user7659542
@Mgetz using cpp wouldn t have prevented those geniuses from defining such a macro
 
No it wouldn't have, but the cultural issues that are keeping C in place are also the same ones putting you at grave quality risk
you're not safe to ship C code much less python
 
user7659542
@Mgetz seems like you are blaming the people more than the C language
 
1:58 PM
Yes... that's precisely the case. In a quality critical environment, empiricism, automation, and agility are critical to safety
 
user7659542
@Mgetz so it is not the programming language necessarily which should be changed...
 
@traducerad start with culture, then make reasoned decisions about tooling. Personally for quality critical I'd probably go to Rust personally. But C++ is still a good option. I think that C just adds too much chance of UB to be truly safe in quality critical.
 
user7659542
@Mgetz how can a young chap change a culture when you have "seniors" who write stuff like #define STRUCT_CLR(\_st\_) memset(&\_st\_, 0, sizeof(\_st\_)) ?
 
@traducerad ask your seniors to do code reviews and generally start pushing (albeit gently) in the right direction
 
user7659542
arguing against everything leads you to be considered as that young a-hole who thinks he knows everything
 
2:04 PM
the important thing is to start the conversations
not to force them
 
user7659542
@Mgetz I ve been fighting for those things for 5 months now. Feel like they now finally started to realize I am right but
 
user7659542
they re just taking my advice, trying to apply it and will never promote me or whatsoever
 
user7659542
because I am that young chap
 
user7659542
so I am tired of giving advice
 
Remember as the person pushing for change it's on you to show benefit. Automation is easier to make the case for etc.
@traducerad then find a new job
tbf you probably have a lot you can learn before you're promoted
 
user7659542
2:06 PM
@Mgetz I am indeed affraid that is what I ll have to do
 
in much of the industry it's the only way currently to get a promotion
 
user7659542
@Mgetz it = finding a new job?
 
yes
also you don't need to ping on EVERY message
 
user7659542
@Mgetz almost 3 years of exp, still considered as a junior
 
not surprised
To me a 'Senior' dev is a dev who can mentor
most devs never get there
 
user7659542
2:08 PM
telling seniors and people with way more years of experience what to do and finding gaps in their code and not being promoted
 
user7659542
this must be a joke
 
no
juniors can contribute to quality too
the team as a whole is part of quality
 
user7659542
@Mgetz what does mentoring mean to you? Spotting bad practices, flaws in sw architecture and knowing how teams should be managed to be efficient (eg via devops)?
 
please DO NOT PING FOR EVERY RESPONSE
Mentoring is complex, it's a lot of things and a lot of people skills in terms of being able to make things happen. Most importantly it's the skill of developing a Junior into a good developer.
 
user7659542
do engineers really have time and willingness to do this? I don't think other people are willing to this invest time and effort
 
user7659542
2:16 PM
most people are very ungrateful
 
Where I work yes they do. If you want to have good people to work with, then it's on you to help them get there. Don't depend on others to mentor and guide kids straight out of college. It's important to remember that everybody is learning, even a senior. A junior dev can mentor a senior and vice versa. Approach development with humility and and a willingness to learn.
Honestly as a senior, mentorship is the most important part of my job
 
2:32 PM
@traducerad Fro better or worse, even if you're considerably better than your peers, it takes (lots of) time to get promoted. Part of why I left the Air Force was that there the promotion structure was all explicitly documented, and it was obvious that most of eligibility for promotion came down to seniority--your quality made only a tiny difference. In real life, it's not documented, but is actually similar.
 
3:05 PM
@traducerad POD = plain old data, where the constructor, destructor and copy constructor don't do anything interesting
As a counterexample, std::string is not a POD.
 
@fredoverflow Despite the fact that characters are as alike as peas in a pod.
 
3:52 PM
As C++ supports multi-inheritance, if I have a data holder like "a Position" or "a Region" would it be better to just let something inherit from these classes or should these data holders just be members of these classes (considering that everything the containing classes would do is delegate things or provice accessors to the data holders)
Like:

"Anchor" inherits from "Position" and "Region" inherits from "Position" and "Dimension"

or

"Anchor" contains a "Position" and "Region" contains an "Anchor" and a "Dimension" but all these classes would do is provide an "Anchor.getX()" or "Region.getWidth()" that would just delegate to "return this->dimension.getWidth()" (and even havnig a getter seems redundant if there is nothing to check for)
 
prefer composition over inheritance
 
with public attributes or only through accessors?
 
depends on what the user code needs
 
4:18 PM
basically just access to x and y coordinates
... can a reference variable be initialized with an object of a sub-type of the reference?

Supertype &sup = Subtype(vars);
 
@salbeira Basic question: is an anchor a position, or does an anchor have a position? Is a region both a position and a dimension, or does a region have a position and a dimension?
@salbeira Yes.
But at least in C++, "supertype" and "subtype" are rarely used. We'd more often refer to a "base class" and a "derived class".
 
Thanks!
 
@salbeira Are you sure they need to be publicly visible/accessible at all?
 
Well ... the boilerplate code would be reduced
I deem it easier to write

element.position.x

instead of

element.get_position().get_x(); (and I would need to write the get_pos and get_x functions too
I mean I can also write an element.get_x() function that delegates stuff around but ... eeh ...
And again I am conflicted here:

A UI Element most definetly IS a Region on the Screen but only if said UI Element is actually visualizable (A Radio Button Group is most definetly part of the UI but is most definetly not visible - the Radio Buttons are, but not the grouping)
 
@salbeira I think you're missing the point I was trying to make Why should outside code need access to the element's position at all? It's hard to guess in the abstract whether it's really necessary, but if possible, the outside world should be able to deal with it at a more abstract level, instead of having to get/manipulate its position directly. Better to say: "go to Santa Fe" than: "go forward 100 yards, turn right, go a half mile, turn left, merge onto the freeway, go 17 miles, ..."
 
4:34 PM
Futher down the road the elements need their position be accessible so the renderer can actually draw stuff on screen at the position they are
 
@salbeira Why don't they draw themselves at the correct position?
 
They do
 
@salbeira So would you say that if I move a button from one part of the screen to another, it becomes a different button?
@salbeira Perhaps I don't understand what's being done then. If they draw themselves, why does a renderer need to know where they are to draw things where they are?
 
Oof I am typing and typing and I do not think I can get a good abstract explanation
I am simply dissatisfied with how in the end I need to formulate this rendering code
In the end I need to unpack so many information
And I am already playing with the idea of having a "ElementVisualizer" that does the rendering for each part so I can - theoretically - exchange the algorithm that brings stuff on screen. So if I have that kind of call hierarchy:

UI.draw(Renderer &r) -> Element.draw(Renderer &r) -> Visualizer.draw(Renderer &r, *this);
And at that moment the visualizer needs access to position and sizes
If there is some kind of Guideline / Tutorial that explains how to completely organize and write a Widget GUI Rendering Engine from scratch with only GLFW Callbacks available, I'd be so happy because almost noone wants to talk about "How to write that stuff"
 
5:49 PM
 
> Water boils at 202°F
I have absolutely no idea what that means and how different that is to sea level
 
Why is he using Fahrenheit, I thought he is a reasonable person and uses Celsius ...
Seems like Water usually boils at 212 F°
 
American
 
only some of those are true
 
how surprising
 
6:30 PM
@Mgetz Like who'd care about the date when lighting a doobie in Colorado?
 
@JerryCoffin anymore only CU
 
@salbeira 212 at sea level. Oddly, the temperature change works out really easily using a combination of US and metric measure: the boiling point drops about 1 degree C for each 1000 feet of elevation gain.
@Mgetz Once they're old enough for their acne to clear up, they won't have to worry nearly as much about dates.
 
@Mgetz Whoosh?
 
@JerryCoffin the university of colorado closes campus annually on 4/20
 
7:23 PM
@Mgetz Yeah, I was saying without acne you look better, and getting date (like, taking somebody to a movie or dinner) is easier.
 
 
4 hours later…
10:59 PM
@JerryCoffin If you've ever seen the Pawn Stars show, I feel like you could easily stand in for "The Beard of Knowledge" from time to time. I don't know if you'd look as cool as The Beard though.
 
@CaptainGiraffe 'fraid I've never seen it. Nearly the only TV I watch is Netflix.
 
11:23 PM
Most TV series I have watched are from youtube. Cut down version too - like 1 season in an hour.
 
11:34 PM
Flavorite Tomatoes has become Australia’s largest greenhouse tomato production, packaging and marketing business, and a significant employer of skilled and semi-skilled workers, not only in the Gippsland region, but also throughout Australia. The company produces 4000 tonnes of tomatoes a year and holds 60 per cent of the Australian market.
You are telling me more than half of the tomatoes on the market have been grown in tanks of human poop and urine??
I think I am disincentivized to buy tomatoes for the rest of my life now.
 
@TelKitty I wondered that, but I don't think that's what it's saying. Looks like it's just that the company that grows tomatoes has (entirely separate from the farming part) a Worm Farm septic tank (but the two aren't connected beyond it happening to be cone company that does both).
@TelKitty Even if they're not using human waste products, it's certainly true that manure from various animals has been used as fertilizer for centuries. At one point, availability of guano (bird/bat poop) was considered a limiting factor on the earth's population...
 
11:59 PM
@JerryCoffin Some animals poop, for example, cow or poultry poop have been used as fertilizers for centuries. But they are considered safe as poultry and cows are not very close related to humans. Disease tend to transmit between hosts that are similar to each other.
 

« first day (3140 days earlier)      last day (1791 days later) »