« first day (2144 days earlier)      last day (2803 days later) » 

@Ven yep, that sounds like a guitar
 
I have a habit where for complicated template classes (template of template parameters) I make a #define for the template header and template parameters so that I don't repeat them for every member function of my class, and so that if I do a change to the template parameters, I remain on the safe side of not doing a mistake. Is this a bad habit? I got yesterday criticised by a fellow programmer for that. What do you think?
 
nwp
mixing #defines and templates seems like a terrible idea, but without seeing the code I'm not completely sure the #define version is worse than the regular version
 
Criticised by a fellow programmer? No way
 
nwp
@TheQuantumPhysicist you could post a sample on codereview.stackexchange.com and see what they say
 
2:13 PM
#define HashBucket_TemplateHead template <template <typename Key, typename Value> class T, typename Key, typename Value>
#define HashBucket_TemplateTail <T,Key,Value>
Here's an example...
@nwp Thanks. I'll do that at some point.
Does this look so bad?
Now I just use these headers for every method
 
@TheQuantumPhysicist I have done that before as well. However, I undefine the macros at bottom of my headers.
 
@wilx That's a good idea actually! Thanks for the hint
But is this bad? And why? I don't see why it's bad, and would appreciate some insight
 
@TheQuantumPhysicist Well, using macros is generally frowned upon.
 
@TheQuantumPhysicist Because of their global scope and as consequence because they can make good code bad just because you collided with some existing macro.
 
nwp
2:17 PM
because macros do not play well with scopes and have various surprising side effects because they generally know nothing about how the language works
 
Ven
Macros are amazing. But no C(/++)'s
 
Rust macros are dank
 
And if I undef them at the end of the header file, does that make it any better?
 
Ven
@набиячлэвэли they're dank because they stole racket's
@TheQuantumPhysicist oh, it does make it a bit better, but it's still donkey shit.
 
nwp
donkey shit with perfume on
 
2:20 PM
So you guys think it's better/safer to copy/paste all template headers and it's not that bad to have to change all template instances when the template header has to be changed?
Is there a neater way to do this?
 
Ven
generate code
/shrug
 
in how many decades will C++ receive a non-retarded macro system?
 
@Ven What's that?
 
Ven
never
they want to give it reflection
@TheQuantumPhysicist ¯\_(ツ)_/¯
 
Actually I use macros quite very often. For example, if I have a program that uses some Math libraries for matrices, I define macros for general functions like inverses, SVD, matrix exp, etc... and then switch libraries by a single define...
Now you guys are scaring me :D
 
nwp
2:22 PM
maybe some day we can have using HashBucket_TemplateHead = template <template <typename Key, typename Value> class T, typename Key, typename Value>;. Still feels like obfuscation to me, but at least the obvious issues are gone.
 
Ven
@TheQuantumPhysicist No, I can assure you you're the one who's scaring us.
 
oo the PoI errors I was running into were bugging me and now I remembered how class scope works
 
@Ven hahahaha! Why? I'm quite peaceful :D
 
Ven
I can't consider you to be "peaceful" if you use C macros abundantly.
 
@Ven So for applying to some job I definitely shouldn't do this in my sample code?
 
Ven
2:25 PM
I mean, I definitely don't know what's your use case here. But using it to abstract over which lib you're using underneath... no
 
@redspah when C++ has been superseded by something better.
 
Ven
^ ahahhaa
 
For some job application I was asked to create a thread-safe HashMap. So I used the code you see above to alias all complicated template calls. I'm going to submit this code soon (unless you guys scare me enough to change it back to copies of template code)
 
@Ven what would you use otherwise
 
Ven
whichever you bother with.
 
2:28 PM
@ratchetfreak
> C++ getting superseded
> ever
nice meme
 
Ven
@milleniumbug instead of macros? functions?
 
sure but you have to make a decision somewhere
in a build system or sth
 
@Ven functions to replace this: How?
#define HashMap_TemplateHeadWithDefault template <typename Key, typename Value, typename HashFunction = std::hash<Key> >
#define HashMap_TemplateHead template <typename Key, typename Value, typename HashFunction>
#define HashMap_TemplateTail <Key, Value, HashFunction>
 
Ven
@milleniumbug no?
typedef int (*fn_add_t)(int, int);
fn_add_t fn_add;
void enable_lib_a() { fn_add = lib_a_add; }
@TheQuantumPhysicist i'd replace them with my hands
 
@Ven Well that's the last resort. So I'm chatting here with you guys to see the bad/side effects of doing what I'm doing
 
2:32 PM
#ifdef __has_include(<optional>)
#include <optional>
#else
#include <boost/optional.hpp>
#endif
@Ven that would assume you have all the libs visible and linked
 
Ven
@milleniumbug no
fn_add isn't static.
 
yes
oh, you're going the "load pointers" OpenGL style route
that's terrible
no one likes it
 
Ven
okay then use object orientation with virtual methods
¯\_(ツ)_/¯
 
~~overhead~~
 
Ven
okay, then use a template specialized with the tag for your library.
¯\_(ツ)_/¯
 
2:37 PM
sometimes may work, sometimes it doesn't
 
Ven
please provide actual arguments then
 
choose an optional<T> implementation
Boost one if it's available or a standard one if it's available
 
Ven
that's not solved in your previous message, btw. you still need to alias the template
 
what template
 
Ven
optional<T>
unless you use namespace std; using ns boost;
 
2:40 PM
which means using the preprocessor
 
using is not preprocessor
 
Ven
that's in your case
@ratchetfreak yeah but you need the preprocessor to use has_include
I mean sure, your predicate for "which lib to use" is "decide via the preprocessor"
in that case you definitely need the preprocessor.
 
How can I use using to replace what I'm doing in that code?
 
Ven
we're not talking about your code
 
@Ven So it's not possible? Too bad!
 
2:47 PM
void f()
{
#ifdef _WIN32
    // WinAPI impl
#else
    // POSIX impl
#endif
}
alternatively, in the different source files
so the decision is made by a build system
oh look someone is trying to reinvent pattern matching reddit.com/r/cpp/comments/505b5w/rangebased_if /cc @Griwes
 
Ven
> Bing translates “Daesh” as “Saudi Arabia”, angers entire Kingdom
 
3:13 PM
Well there's not much of a difference between Daesh, Islam and Saudi Arabia. I think it's a good thing xD
 
Ven
sorry wat
 
If that's a joke, you may want to delete that.
Out of context it looks inconsiderate af
 
@SterlingArcher out of context? I thought we chat here, not only and specifically talk about C++
I'm an ex-muslim, so I have an opinion about all that stuff
 
Ven
and I have an arabic friend. That means I can insult a few hundreds millions people?
 
@Ven I'm Arab actually. But what does that have to do with what I said?
I'm not saying all Muslims are terrorists or all Muslims are so and so
I'm merely talking about a religion. It's an ideology.
Some people have a moral compass that's better than Islam, even though they think they are Muslims, but they only use a subset of what Islam says and follow it selectively, while ISIS does everything that Islam says
 
3:24 PM
@TheQuantumPhysicist what's good about it?
 
It's a complicated thing
@Abyx Good about what?
Ah
Calling them the same? Well it's just ironic because it shows they're not that different xD
 
@TheQuantumPhysicist welp they're not true muslims then
 
@Abyx Who's not true Muslims?
 
@TheQuantumPhysicist those who follow islam selectively
 
Quiz: What compiler optimization causes this?
-1
Q: Bug in VC++ 14.0 (2015) compiler

Hasan Al-JawahiriI've been running into some issues that only occurred during Release x86 mode and not during Release x64 or any Debug mode. I managed to reproduce the bug using the following code: #include <stdio.h> #include <iostream> using namespace std; struct WMatrix { float _11, _12, _13, _14; flo...

 
3:27 PM
@Abyx Which is the majority actually
@Abyx but you're right. That's what I exactly say
@Abyx A true follower of an ideology is someone who embraces it all with no selectivity
 
@Ven Well. You can.
 
@Mysticial aliasing analysis maybe
 
@Ven You can insult literally every person on earth v0v
 
Ven
@sehe "technically" correct, huh :)
@набиячлэвэли shut up nab
 
open down ven
 
3:31 PM
Yeah you also can write code that does UB
 
beautifyl
@milleniumbug No you cannot
You can only write code that /has/ UB (or programs that have it, consequently)
 
@sehe What if it generates code that has UB?
 
@TheQuantumPhysicist what do you think, is it possible to do something about Islam? like making it disappear for good
 
How is that "doing UB"?
 
@sehe indeed
My sloppy wording hits again
 
3:32 PM
@sehe Seems like afitting definition.
 
@Abyx Well, if we were able to tame it, just like all other religions were tamed, that'd be great
 
@Morwenn Yeah. Donald Trump wants you in his campaign team
 
@milleniumbug Can you be more specific? Since that's not a compiler optimization in itself. :)
 
@Abyx Almost all religions have violence and problems in their books. Their people, however, found ways to lessen their problems somehow
 
Ven
2
A: Function and class documentation best practices for Python

Eric Meadows-JönssonThe best way to learn documentation practices is probably to look at the source code of a well known project. Like the Djangoproject.

 
3:33 PM
@Abyx I wish Muslims do the same... but it sounds impossible
 
Ven
Lol, the co-dev on Elixir used to crappily answer python questions
 
Needs a very, very long time
 
Right, it's a step that optimizers do in order to find out places to apply optimizations
Not familiar with the optimizations enough, so I think I'm gonna pass on this one
 
@TheQuantumPhysicist other religions don't have such mechanisms as calling everyone "infidels" and starting a war on them
 
@milleniumbug This is tough question. I don't expect too many people to know it. :)
I'm not 100% certain of the answer myself. But I know for sure that the optimization pass that I have in mind will likely cause it.
 
3:37 PM
@Abyx I do find Mohammed much more troubling than Jesus or even Buddha.
If he were just a prophet, maybe one could minimize or dismiss him, but he is supposed to be THE ONE TRUE PROPHET.
 
@Abyx Maybe, but they have other violence problems and issues that depend on interpretation, such as slavery and homophobia, etc...
 
Ven
and I'm the One True Poney
@rightfold ping
 
probably the problem is that there aren't any poor radical christians, but there are many poor muslims.
 
@Abyx Sure there are.
I don't know what you call a Christian in say, China, if not "radical"
2
 
@Abyx Christianity had its dark ages, and now Muslims are having theirs
 
3:45 PM
There are plenty of radical but wealthy Muslims.
 
@TheQuantumPhysicist I think that's an oversimplification, but it sounds truthy.
 
The point is that people have come to appreciate the sanctity of human values more than that book
@caps I think it quite fits what's going on, because the same headline problems we see now adays in Muslim countries is the same that was in Europe, like 500 years ago
 
@TheQuantumPhysicist That's why it sounds truthy.
 
@wilx they don't carry suicide belts or ride SVBIED
 
@Abyx No. They cut heads and plan the operations.
 
3:47 PM
@Abyx They just encourage brainwashed kids to carry suicide belts
 
@wilx point is that there should be soldiers, otherwise there will be no war
you cannot start a war for e.g. "radical chrisianity" in Europe because no one would fight for that
but you can start a war on ME because poor population will support that
 
@Abyx I don't know if I caught that correctly, but I don't think it's about poverty on any level
It's about a choice: Human rights vs Ancient book
 
@TheQuantumPhysicist Well, it contributes to it.
 
@wilx Sure, it's not completely independent, but it's not of main importance. The atheistic movement now in Arab countries is done by young, poor men
 
OK.
 
3:52 PM
@TheQuantumPhysicist not really. it's all about whether you want to go and die or not.
and if you have nothing to loose - it's easier to die
 
@Abyx Consider the reason. Why do they want to die? Just like that? Nope. They want to die because they're promised of a better life with their God
 
@TheQuantumPhysicist exactly. better than they have now
 
You have NO idea... how much promises Islam gives to anyone who gives his life for it
Seriously, it's way more than you could ever imagine
 
@Abyx That may also because Europe has fewer Christians, proportionally, than most of the rest of the world, but I think you would be hard pressed to find a country where "radical Christianity" would be a motive for war.
 
@TheQuantumPhysicist but those are promises.
 
3:55 PM
@caps Well this comes back to my theory: The majority believes that Human rights is more important than following that ancient book, and hence they invent interpretations to make it peaceful and more appealing
@Abyx But a believer believes them by faith ;)
 
@Abyx You can't dismiss that radical Islam provides a (seemingly morally justified) outlet for revenge on the Westerners who have (sometimes rightly and sometimes wrongly) been accused of doing great harm to the ME.
"Stop bombing Syria" is something you hear ISIS terrorists say to the west.
 
@TheQuantumPhysicist well "human rights" is a bullshit invented by westerners for their own reasons
 
@caps Actually the hatred ingrained in Muslims against the west is part of the problem
@Abyx Is this your opinion or what they would say? Because I don't see how the west could benefit by saying that all humans are equal
 
@TheQuantumPhysicist Here's my theory: the west believes in human rights because Christianity is an integral part of Western philosophical DNA. The west may have taken it in directions Christianity did not, but I think that's where the idea originated.
 
@caps yeah, but it more stems from the crusaders rather than recent bombings
 
3:58 PM
@Abyx That was a really really long time ago. Do you think the ME has been collectively hating the west ever since then? I'm skeptical.
 
@TheQuantumPhysicist in my opinion perceptions of human rights differs from culture to culture, and western human rights might be wrong.
 
Clearly I'm confused. I thought Abyx was a SJW. Am I thinking of someone else?
 
@caps religions have long memory.
@caps lolwut?
 
@Abyx Well, human rights are defined in a document. It's quite perception-independent
 
@TheQuantumPhysicist lol
 
3:59 PM
@caps j*lf?
 
@wilx Ah! Yes. That's right. Why did you put the '*'?
 
And you know what's the best thing about that document?
 
@TheQuantumPhysicist ... except for the perception of the people who wrote the document...
 
It's written by people, so it's not sacred
and it can be updated and made more clear when ambiguity exists
 
@caps That name shall not be said! :D
 
4:00 PM
@caps Actually I'm trying to emphasize that things that people write and that are not sacred are perception-independent, because we can update them
 
@TheQuantumPhysicist yep. or amended to be fit to some western needs which have noting to do with me. it's a purely political thing.
 
We sit on a round table, and agree that "this is not clear, let's make it clear"
Boom. Done!
@Abyx Again, how could a document that makes all humans equal by giving them exactly the same rights, be used for someone's interest or political agenda
this I can't understand
 
@TheQuantumPhysicist well here is an example. West blames non-allied countries like Russia for violation of human rights on every possible occasion. But de-facto ignores violations in allied countries, like Turkey.
"human rights" it's nothing but a political instrument.
 
@Abyx This doesn't seem to be a problem with human rights, as a document.
The problem would arise int he following case:
 
@TheQuantumPhysicist yeah, on paper it's an awesome thing
 
4:05 PM
If you CAN'T blame Turkey using the same document, just because it's Turkey and it's somehow immune, then that's a problem
@Abyx It's a document! That's everything it has to do ;)
 
@Abyx No, "West" does not ignore it. You are just living in a bubble of Russian media.
 
@wilx uhm, Turkey, for starters?
 
Ven
HAHAHAHAHA WTF PYTHON
 
@wilx I know, but I'm just following @Abyx's logic, and showing that it's invalid even if it were true
@Abyx Does the Human rights document give immunity to any part of the world over any other part?
 
@TheQuantumPhysicist no it doesn't. but it don't need to
 
4:09 PM
@Abyx With the same logic, I could blame every document on earth by claiming it can be used for evil purposes
 
@Mysticial I hesitate to call any of it "optimization". The code produced for both is almost humorously bad. For example, the compiler has managed to take a simple mov ecx, 16 and turn it into push 16\npop ecx in both of them. Seems like the sort of thing even the simplest peephole optimizer would fix, but for some reason, theirs apparently doesn't recognize this pattern.
 
anyways, the point is that this international human rights things was invented to harass other countries. Because locals laws are enough to have appropriate human rights in your own country.
 
@Abyx I have just shown that this is not true. It's your opinion anyway :)
@Abyx Btw, you're welcome to visit arab countries and see how local laws are
 
If anyone is interested, the optimization that is "breaking" this is most likely Scalar Replacement of Aggregates. The compiler is able to prove that matrices don't alias with anything and that nothing (except for _11) has its address taken. So the compiler is "pulling" the rest of the fields out of the struct and optimizing them as scalars rather than as members with a specific location in memory. That's why *(&out._11 + idx) doesn't work because the fields are no longer where you expect them to be. — Mysticial 1 min ago
/cc @milleniumbug
 
@Abyx Human rights are almost completely absent in Arab countries
 
Ven
4:12 PM
@Mysticial damn.
 
Try Saudi-Arabia, that jailed a person for 10 years for starting a liberal forum that talked about Islam
 
@TheQuantumPhysicist yeah, but KSA is an ally of US, so de-facto that human rights document doesn't affect'em.
 
@Abyx US is not the world's police to enforce implementing human rights. Human rights are there, you can do them, or ignore them
That's a choice
 
@TheQuantumPhysicist except that US will interfere with you if they don't like you
 
Where did I put my popcorn
 
4:16 PM
like with Iraq or Libya
 
@Abyx Two things: First: Say that's true, does that make us blame the document? Second: Iraq and Libya were attacked for different reasons that have nothing to do with human rights
 
or those multiple US-paid "human rights" organizations in Russia with do nothing but shitty propaganda against Kremlin.
 
@Abyx Russia can do the same in the US, right?
 
Kremlin the new JVM-based language?
 
@TheQuantumPhysicist the document doesn't work in any useful way.
 
4:19 PM
@Abyx You need to live for some time in Saudi Arabia to see whether it's useful to have a document that discusses your rights
 
@TheQuantumPhysicist need KSA sponsoring for that
 
@Abyx If the situation is not perfect, it doesn't mean that everything that made it better is not useful
 
@TheQuantumPhysicist uhm, does it help people living in KSA?
 
@Abyx It shows a path to fight for
It shows the right way to do it
You can ignore it, or do it
 
@TheQuantumPhysicist I don't think they need a written document for that.
and there will be no fight anyways.
 
4:22 PM
@Abyx I think you're forgetting how humanity was like 200 years ago, when the black were enslaved by others just because they are black
Yes, you need a document that says: This is the way we should do it
Otherwise you can't hold anyone accountable
 
@TheQuantumPhysicist and it was the whites who liberated them, in US. The blacks still have slavery in Africa.
 
@Abyx Actually that's not true, but that's a different discussion
There were many, many revolutions that corrected the way it's
It's history
 
Ven
@AndreasPapadopoulos no Kremlin where the KGB is
 
you can't just give one cause or solution to everything
but you can summarize your experience in a useful document
 
it's time for me to go home.
 
4:25 PM
@Abyx OK!
See you later!
 
user1804599
Lol an Abyxmal conversation
 
Ven
pretty much
Wrote myself a nice little fuzzy git checkout. Perl 6.
 
user1804599
awful
 
user1804599
Speaking of awful programming languages, I'm going to split my PureScript web framework into multiple libraries
 
user1804599
Routing can be completely separate from the others because of row polymorphism. :3
 
4:42 PM
@TheQuantumPhysicist I don't think it was really particularly because they were black. The largest, most convenient supply of people who were relatively easy to enslave were in Africa, so they happened to be black. It's undoubtedly true that having an obvious differentiation between slaves and masters was convenient (for the masters) as well, but it was still more or less incidental. Before transportation from Africa was convenient, whites enslaved other whites quite routinely.
I don't know African history quite as well, but I'd be rather surprised if there wasn't a fair amount of slavery there where blacks enslaved other blacks. Likewise, in North America native Americans routinely enslaved other native Americans. Lack of obvious differentiation between groups doesn't seem to have made much difference in what happened (at least as a rule).
 
@JerryCoffin Btw, that optimization that I mentioned, "Scalar Replacement of Aggregates" is one of those "do-or-die" optimizations that I've come to rely on for zero-overhead abstractions. It lets you wrap things in a struct without any overhead - somewhat critical for TMP.
Default copy-constructors and copy-assignment for POD structs will inhibit that optimization because the standard requires it to be the same as memcpy'ing the entire struct.
So I often find myself implementing copy-constructor/assignments for PODs by manually assigning the fields for this very reason.
 
4:57 PM
@Mysticial Ah, the tangled webs we weave, when we practice to deceive (the compiler into getting out of its own way, and producing decent code in spite of itself).
 
hellllllllllllllllo
 
@TURNUPTHEMUSICLET'SDANCE hellllllllllllllno
 
oh helloo
 
@JerryCoffin Pretty sure that Romans enslaved other Romans quite liberally, and some of the treatment of e.g. early English peasants was little better.
 
@JerryCoffin Yeah. One of the (ab)use-cases of this optimization that I over-use is making local copies of a very large struct to work-around the compiler's failure to disambiguate memory. For example:
 
5:01 PM
@Mysticial that’s not quite accurate though
 
struct MetaData{
    double a, b, c, d, e, ...
};

void func(const MetaData& meta, double* x){
    for (int c = 0; c < 100; c++){
        x[c] *= meta.a;
    }
}
When restrict semantics fail, the compiler will reload meta.a at every loop iteration.
The work-around is to do this instead:
void func(const MetaData& meta, double* x){
    const MetaData local(meta);
    for (int c = 0; c < 100; c++){
        x[c] *= local.a;
    }
}
The MetaData object is a zero-overhead abstraction that changes types depending on what I'm compiling for.
Intuitively, you would think that this is bad because you copy the entire struct.
True, you do. But once the compiler applies SRA (Scalar Replacement of Aggregates), it turns it into individual loads of all the fields. You're only using one of them, and DCE (dead code elimination) wipes out the loads for the rest of the struct.
@LucDanton I'm not sure on exactly what the details are, but most compilers implement large POD copies as memcpy() which completely prevents SRA.
 
@Puppy England was better than most in this regard. Really early on, serfs had essentially no rights at all, but England abolished serfdom quite a bit earlier than most countries (circa 1400, if memory serves). Peasants were still treated pretty poorly, but there was at least some minimal recognition that there was some limit on how much you could abuse them.
 
Xeo
We should abolish smurfdom here.
 
@Mysticial it’s a matter of QoI, not compliance
 
@Xeo But SO is a smurfdom. The smurf is dead. Long live the smurf.
 
5:15 PM
@Mysticial you could also make a local copy of meta.a.
but of course, you know that :P
@Mysticial right
I've got some nice examples of this from my protocol stack code.
 
@StackedCrooked The example here isn't great. The real use-case is similar to this:
struct MetaData{
    double a, b, c, d, e, ...
    double operate(double x){
        return a;
    }
};

void func(const MetaData& meta, double* x){
    for (int c = 0; c < 100; c++){
        x[c] *= meta.operate(x);
    }
}
The MetaData object differs by compilation target. func only knows that operate() exists. It knows nothing about the fields which also differ by compilation target.
Some targets use only 1 field. Some use multiple fields. At run-time, I only want to copy the ones that I use onto the stack to help the compiler disambiguate it with the x array.
 
sounds to me like you might be better off JITing your code.
 
Actually, it's not exactly the same.
 
or just writing it in assembler ;p
 
I was thinking of memcpy "elision".
@Mysticial Mike Acton showed a similar example in his talk on cppcon back in 2014.
It hoisted a member variable instead of a param. But I guess the principle is the same. (Aliasing.)
 
5:23 PM
@TheQuantumPhysicist I'm not sure you understand sacred texts.
 
@StackedCrooked Ah. I used to directly access the members. But different targets had different optimal ways to do a SIMD 64-bit integer multiply. For targets where vectorization is disabled, the MetaData struct had only one 64-bit integer and simple operate() method. For targets with SIMD, the MetaData struct has 2 elements (each with half the operand), and the operate() did the bignum expansion of a 64-bit multiply as multiple 32-bit multiplies.
 
@Mysticial I guess inlining can also help here.
 
Then later versions of SIMD (SSE4.2) had better implementations for a SIMD 64-bit multiply. So they had their own versions of MetaData with their own customized set of fields.
 
@JerryCoffin Many Africans were sold to European slavers by other Africans.
 
I think the current code is up to about 5 or 6 different MetaData types for different targets. But still only one func for all of them.
Which is the whole point of the zero-overhead abstraction - to keep only one version of func.
 
5:28 PM
One func to rule them all :P
 
And of course operate() would be force-inlined. Otherwise it defeats the purpose of everything.
 
@caps Sure--the Europeans weren't interested in trekking through the jungle to find slaves when they could find others who were already familiar with the local terrain and society who were entirely willing to do that for them.
 
@JerryCoffin Exactly. People treat each other like crap.
 
So basically, the loop (with the local copy of `MetaData`) is only efficient when all of the following optimizations are applied:
1. Inlining of `operate()`.
2. Scalar Replacement of Aggregates on `MetaData`.
3. Dead Code Elimination of the unused portion of `MetaData`.
4. Register promotion of the used portion of the local copy of `MetaData`.
 
5:30 PM
Every compiler that I use has (almost) always succeeded in 1 - 3. #4 is questionable depending on register pressure.
Ironically, ICC is the one that (at one point) failed #1 due to a bug in the compiler that made it ignore the force-inline.
 
nwp
I had a nice little `map<string, string>` and everything was fast and easy to understand.
Then I thought that a radix tree would be better and things got more complicated.
Now I'm thinking that every node is dynamically allocated and contains a string that also gets dynamically allocated; they should be allocated together.
I think I'm gonna prematurely optimize the shit out of this code and hope I get cured for a while.
 
@nwp How would you do that cleanly?
 
@nwp Make sure to establish your baseline first.
 
nwp
@caps not sure, maybe not possible to get the allocation thing correct without UB
@StackedCrooked the baseline is ridiculously good since a map<string, string> is pretty simple and performs well, so there is no chance winning in clearness and the microseconds saved will not be noticeable
I don't know why I do it anyways
 
Simple code has great value.
 
user1804599
5:38 PM
You can't write simple code in C++.
 
user1804599
Too many pitfalls and special cases.
 
@Mysticial how do you reconcile #1 and #3 with the idea that "[func] knows nothing about the fields"?
whoah twitch VoDs remember where you last stopped, or maybe that’s the HTML5 player
 
@LucDanton func doesn't know about the fields from the source code POV. At compile-time, the processor picks the right MetaData which is included before the body of func(). So at compile-time it will know the fields of MetaData.
 
@caps More to the point, many people tend to be more concerned about themselves than others. They'll treat others like crap primarily if they see a benefit to themselves in doing so (but, for better or worse, there often is).
 
@JerryCoffin nods
 
5:44 PM
@LucDanton But func() itself is written only knowing that operate() exists. It makes no assumptions about the fields of MetaData.
IOW, func() behaves like a template with typename MetaData.
 
@Mysticial I think I see what you are getting at. you can totally have a auto loaded_things = meta.load(x); x[c] *= meta.operate(loaded_things); if you want btw if that has any hope of helping the compilers
not that copying outright the meta object is not a great solution
 
@LucDanton I thought about having a separate "smaller" object that contains only what is needed for each operate() method that it has. But that got a little unwieldy in terms of code-bloat.
Doing that only solves #3 - which all compilers are already able to do.
It would also solve #1 if MetaData lacked a copy-constructor that manually copied each of the fields. (due to the memcpy() pessimization)
 
.. Is anybody familiar with Lua C API here?
 
@Xeo btw, are you watching Rewrite?
 
5:56 PM
@milleniumbug Well, I have this question on SO: stackoverflow.com/q/39211143/3211851
 
16
Q: How to make a Spherical Cow?

SumitBeing a theoretical physicist, I always have a great respect for Spherical Cow. So I thought about making one myself. I am not sure how can I create (something considered to be the simplest!) this marvel. One possible way could be using the ExampleData for Cow and map it on a sphere - something ...

hehe
 
6:15 PM
Morning guys :) Quick redirect question - does anyone know what the specific term is for template specs with < ... >?
I tried searching up optional/default template args, but that led to < typename T, typename U=T, typename V=U >, and searching with the literal "..." didn't give me much information either
 
@OneRaynyDay You can try looking up language related info here: en.cppreference.com/w/cpp/language (i.e. the language section of cppreference)
 
Ah, got it. Thanks! : ) It's called a template pack
I hate templates.
Ugh - Additional question: Does anyone know how to give a template pack a default typename type?
Here's a coliru for y'all to play around with the normal template packing & unpacking behavior: coliru.stacked-crooked.com/a/8bce332e3a5674c4 I've been using it to attempt default values(don't see it in the docs)
 
6:33 PM
@OmegaExtern Thanks! I appreciate it when people link their questions, else I cannot downvote them.
 
> Reading your original comment makes me think that Cities: Skylines will rock your world. Don't worry, you'll forget your kids in no time!
vidya gaems solve everything
 
7:00 PM
there is a c++ room now?
 
@A.H. yes, and I don't think this lounge is a C++ room.
 
we complain about it a lot
I think it counts
 
I dunno I always felt like C++ always played a part in this room, like a shared experience or stockholm syndrome group therapy
12
 
user1804599
7:42 PM
@Ven go to Haskell eXchange London too
 
Ven
@rightfold when's that?
 
@Ven it's pinned on the left
 
Ven
I'm on mobile
 
6th of october
 
Ven
Mmh...
(Thanks)
 
7:53 PM
(if I remember correctly)
 
Ven
8:07 PM
@rightfold so you're gonna be in london the 6th of oct?
 
8:38 PM
RPG Maker helped me rediscover my hate for dynamically typed languages
 
Ven
8:50 PM
also bad roobi
$GLOBALS MUCH AY
 
presence of globals triggers me much less than not having any idea what type the object passed to the function is
 
Ven
9:29 PM
@redspah the worst thing in Ruby is not eing able to even know where the function being called was defined :P
 
ruby doesn't throw exceptions when calling undefined functions?
 
user406009
@A.H. It's the "question room". Basically, all questions about C++ or C or whatever go in there.
 
Ven
@redspah you can redefine functions even on core objects.
Classes are always open!
 
9:46 PM
aliases have the scope like any declaration has
 
you're right
just realized that 2 identical aliases ended up in the same scope
in 2 different files, but still in the same scope
 
Ven
Downvoting an answer or a question feels much better than answering one...
 
nwp
Aug 25 at 15:16, by Ven
.oO( admittedly I'm an asshole )
 

« first day (2144 days earlier)      last day (2803 days later) »