« first day (800 days earlier)      last day (4164 days later) » 

user142019
1:00 PM
I don't see that much.
 
user142019
Except for templates, obviously.
 
user142019
Or when you want header-only libraries.
 
I use C++ API for a flight simulator, and I need to expand some functionality. There, in API, there is a header file with tiny inline function ( cross product of vectors, etc). I expand this functionality with other inline functions, but a little bit complicated
 
eh
for small functions it is not that unusual
 
for example getting rotation matrix by vectors. This inline function has call to 8 other inline function.
Should I rewrite this function in normal way?
 
user142019
1:05 PM
A matrix you say? What is the type of the matrix?
 
user142019
I'd make matrix a template.
 
union with struct
 
user142019
And functions who manipulate them I would also make templates.
 
I'd just use uBlas, GLM, XNAMath, or any of the other dozen extant libraries
 
than I should rewrite more functions, because I use lot of API function... and there matrices are without templates
I think getting rotation matrix is only math thing that I would need... So I'm just interesting.. isn't it so bad, that this inline function has dozen of calls to other inline functions?
 
user142019
1:07 PM
The only functions I ever use inline with are pure virtual dtors. :P
 
user142019
Modules would solve all this crap.
 
what do you call a module?
 
@Innuendo nothing which exists today
 
user142019
The only good way to organize software.
 
user142019
Rather than moronic header files and source files, which are terrible.
 
user142019
1:10 PM
Think modules as in Python and Haskell and Erlang.
 
user142019
And other sane languages.
 
@Zoidberg'-- Pascal or Delphi.
 
user142019
Node.js.
 
Ell
I just want to be able to use a library by including (or using or whatever) one dll
 
user142019
Header + source files isn't DRY. :P
 
user142019
1:12 PM
It makes you repeat function signatures.
 
user142019
That is annoying.
 
user142019
#includes add up. You #include "foo.h" in bar.h. Now if you #include "bar.h" somewhere you implicitly include foo.h with it. Annoying as fuck.
 
@Zoidberg'-- use PCH and you'll include stuff only once
 
user142019
That's not the point.
 
user142019
The point is that I don't want foo(int, int) from foo.h to be in scope if I don't #include "foo.h".
 
1:14 PM
@Ell Nah, you need two.
one for the compiler and one for the runtime
at least, for any implementation which is compiled to native code.
 
@Zoidberg'-- just use namespace foo then.
 
user142019
Each header having its own namespace is terrible.
 
user142019
I want foo to be in scope when and only when I #include "foo.h".
 
did you see that amusing guy with the whole-program struct?
 
me?
 
user142019
1:16 PM
@DeadMG A god struct?
 
not exactly
what he did in order to get around headers
 
in C# of Java it's common thing
 
he put everything in one single struct, because of the far more lax declaration rules
@Abyx Yeah, but nobody gives a shit about them.
 
user142019
lol
 
sbi
Merry Christmas!
 
user142019
1:17 PM
lol
 
@DeadMG nah, it's clever tactics, you just don't understand it
 
@Abyx I understand far more than I'd ever want to about the obscene mess of Java which C# also inherited.
 
sbi
@Rapptz Yessss! (Sorry, I saw The Hobbit last night.)
 
user142019
Languages without modules are terrible.
 
Modules are overrated
 
user142019
1:19 PM
#include is overrated.
 
user142019
Dennis Ritchie y u no modules. :^(
 
sbi
@StackedCrooked I've been there and done that. The shirts are lousy, but if you're lucky good a few things will stick to them and, looking at the company's code written half a decade later, you might find that things might indeed have improved a bit.
@StackedCrooked If mentioning of RAII is indeed still necessary, then this seems like a good first step. Other than that, I can recommend listing a few things you would want them to improve on, write an explaining line for each one, and send this around asking for feedback about what they want to have covered (leaving room for them to suggest other topics). That worked pretty well when I did it.
 
@DeadMG link?
 
sbi
@StackedCrooked *p.x ==> p->x!
 
user142019
@sbi . has precedence over *, not?
 
sbi
1:25 PM
@Zoidberg'-- Oh, that's only a style issue. But also a pet peeve of mine.
 
user142019
operator* is applied to p.x, not to p.
 
sbi
Damn.
 
user142019
Then why did you say *p.x ==> p->x? :P
 
sbi
Yeah, sorry, you're right.
Brainfart.
 
user142019
lol
 
user142019
1:28 PM
I'd blame mondays.
 
is the error that you're using pointers everywhere? :p
 
user142019
The actual bug is the invalid copy semantics.
 
user142019
The copy ctor and copy assignment operator of Point copy the pointers rather than the pointed-to-objects. This results into delete being applied twice to the same pointer.
 
user142019
The main issue is that you use pointers where you should not use pointers.
 
sbi
@Zoidberg'-- I blame getting up at 11, going to buy some groceries at 1, returning at 2, sitting at the computer at 2:15, and somehow having forgotten to wake up in between there...
 
user142019
1:31 PM
The Rule of Three/Five/Zero is not obeyed here, finally resulting in UB.
 
sbi
> Dear Gentlemen, please turn a bit sideways when stowing your overhead luggage in the airplane. — Monika Lischke (translated by me)
Obviously, she had an aisle seat.
 
user142019
struct Point {
    Point(int X, int Y) : x{X}, y{Y} {}
    int x, y;
};
 
user142019
That is the obvious fix.
 
@melak47 Dunno. Let me check.
6
Q: Java style classes in c++

bughiI came across this article proposing a style of coding in c++ that looks a bit weird at first. But after reading it over and pondering for a bit I'm really considering giving it a try. The most appealing benefit is the ease of refactoring methods. I find myself constantly changing method names, ...

 
user142019
> If you want to Java-style classes, then program in Java!
 
user142019
1:38 PM
s/then program in Java/don't program at all/
 
user142019
s/then program in Java/think again/
 
nah, I disagree with that
I think that one of the few things that's good about Java is how the classes are all written straight inline
 
sbi
But then you disagree with just about anything that wasn't invented by yourself. (SCNR.)
 
user142019
Oh in that way.
 
user142019
Oh yeah I slightly missed the context.
 
user142019
1:42 PM
MODULES
 
@sbi Yeah, but by disagreeing with the quote I'm also implicitly agreeing with at least one decision made by the Java designers.
so it doesn't really change my total disagreement count
 
sbi
@DeadMG Oh, I thought the SCNR made it clear that I didn't want to make a substantial contribution to the ongoing discussion, but only used the occasion to slash at you sideways.
 
and this is me parrying that slash
 
user142019
 
sbi
@DeadMG No, you're not. You are insisting on leading a substantial discussion. — In which I am not interested at all.
 
1:44 PM
right
well I'm just glad that nobody else wanted to have a substantial discussion
 
sbi
@DeadMG See, that as a first reply would have been parrying. Your answer, OTOH, was just a child's pathetic attempt to parry an elder's witticism.
 
Ell
I thought parrying was a functional thing o.O
 
that's currying
 
user142019
I think you mean currying.
 
user142019
Or you mean partial application. :P
 
Ell
1:46 PM
Oh yes I do mean currying
 
user142019
Partial application + currying = parrying! :D
 
sbi
I thought currying was the indianification of some non-Indian food?
 
user142019
Speaking of Haskell.
 
Ell
Or thaification, or chification
 
user142019
I once read a good paper about Kleisli arrows, but I can't find it anymore. :(
 
sbi
1:48 PM
I once read good books by Kleist, and they're all still in my bookshelf.
 
user142019
heh
 
user142019
I like it when articles explain Haskell concepts by (re)implementing them along with explaining what happens.
 
Xeo
Haskell hurts my head with al that theoretical masturbation. :|
8
 
user142019
lol
 
Ell
template haskell must leave you aweful sore
template masturbation and theoretical masturbation both at the same time
 
user142019
1:52 PM
Muh I don't like Template Haskell.
 
Xeo
Hm, this game's language is not what I expected it to be... time to get my little knowledge of Japanese together and struggle through this menu...
 
user142019
Great, I found the paper.
 
user142019
@Xeo Write a mobile app that combines augmented reality and Google Translate.
 
user142019
(Probably already exists, but whatever. :P)
 
Xeo
@Zoidberg'-- There are tools to extract text from a game and feed that into a translator, but eh.
Welp, and this game is to be played with a controller... well, seems I'll have to put that off for when I get my Xbox PC controller back.
Damn, I just noticed a typo in my starred message.
 
2:01 PM
nub
 
sbi
@Xeo Why else do you think I starred it?
 
@Xeo What the hell does that even mean? What do you call the C++ standard then, if not theoretical masturbation?
 
Ell
2:16 PM
mathematical abstraction masturbation
 
Writing programs sounds very practical to me.
And programming is all about abstraction.
 
Ell
But not necessarily mathematical abstractions
 
You mean, things like algorithms, sequences, etc?
 
Ell
No, like File/Mesh/Form/etc.
 
What's your point?
Haskell has files too.
 
Ell
2:21 PM
I don't know I didn't really have a point :P maybe it was that programming isn't about writing mathematical abstractions
 
But it is.
People just seem to get annoyed by the fact that Haskell makes more use of some less familiar ones.
 
nah
from my memory, it's more about using them where they really, really aren't necessary
like I remember reading a dozen pages on how mathematical the Error monad or whatever is, and I'm like, "So... exceptions, then?".
 
@R.MartinhoFernandes yeah, like AbstractSingletonFactory
 
also
 
@DeadMG You don't have read the papers about the mathematical underpinnings. That's like legalese.
 
2:26 PM
I slapped a 500 rep bounty on that question about Clang not finding my identifier
maybe someone will answer it now :P
 
(Also, notice how you are dissing it by running back under the skirts of a familiar concept)
 
well, I'll accept that I read it a while ago and don't entirely remember
but the impression I got was that they were basically completely identical
and secondly
it's difficult for me to accept that I don't have to read those papers when the language doesn't appear to contain anything else
I mean, maybe if Haskell had classes and mutable state and non-GC as well, I'd be more encouraged to explore
 
Explore what? What you have already explored?
 
sbi
@R.MartinhoFernandes But the C++ standard is a theoretical masturbation!
 
@DeadMG How's Wide coming along? Or are you still drudging in C++ compat?
 
sbi
2:29 PM
Also, what the hell are you even doing here? Aren't you supposed to be on some airplane?
 
@sbi I have seven hours of boredom ahead of me, remember?
 
Airplanes have wifi these days (or someday in the very near future)
 
@rubenvb Hmm. I'm increasingly coming to believe that the C++ compat is the singular most important feature. So I'd hardly call it a drudge.
although using Clang certainly is a drudge, I guess
 
sbi
@R.MartinhoFernandes Oh, so you're already in Lisbon's airport lounge, huh?
 
@sbi but there is no science in C++, unlike Haskell
 
2:31 PM
What.
 
Math is not Science. Math is Math. Theoretical masturbation that finds application in Science.
 
sbi
@R.MartinhoFernandes I asked whether you are in Lisbon's airport lounge. What "what"?
 
Ell
@rubenvb Math is science
 
sbi
Anyway, you guys only manage to distract me from programming. I'll shut you out now. Later!
 
2:33 PM
@DeadMG If you're going to be designing a new language (such as wide) it seems silly to not learn other languages with radical differences such as Haskell
 
But something masturbation something not what I know and love something.
@Ell Btw, Stepanov built this thing called the STL out of so-called "mathematical abstraction masturbation".
 
Ell
How is the STL mathematical?
 
He just did not use those words when he said it.
 
Ell
And I'm not fighting against it
I'm not even saying anything, like you said some people just get annoyed at the less familiar abstrcations
 
well, at the most fundamental level, I just don't see what I'd stand to gain
 
2:38 PM
> In other words, I realized that a parallel reduction algorithm is associated with a semigroup structure type. That is the fundamental point: algorithms are defined on algebraic structures. It took me another couple of years to realize that you have to extend the notion of structure by adding complexity requirements to regular axioms. And than it took 15 years to make it work. (sic)
 
Ell
Anyway, masturbation is normal and healthy
 
masturbation is just a wankery in the category of circlejerks
 
user142019
@DeadMG what happens when you use clang::Sema::LookupNameKind::LookupAnyName instead of clang::Sema::LookupNameKind::LookupOrdinaryName as the fourth argument to clang::LookupResult's ctor?
 
Ell
2:43 PM
Well Stepanov thinks very lowly of OOP, maybe I just think lowly of the more mathematical ends of progamming
 
@Ell You think OOP does not have mathematical underpinnings?
 
@Ell I believe that the OOP he's thinking of is the "EVERYTHING MUST ALWAYS BE A VIRTUAL FUNCTION" thing
 
Ell
@R.MartinhoFernandes I don't know - I'm not as clever as you
 
@DeadMG Yeah, he means the Java crap.
 
Ell
Let's just leave it at the fact I don't know what I'm talking about
I don't wish to waste anyone's time - I have no interest in learning the mathsy end
 
2:45 PM
But I have so much time to waste :(
15 mins ago, by R. Martinho Fernandes
@sbi I have seven hours of boredom ahead of me, remember?
 
@Zoidberg'-- Hang on, I also broke something else.
 
Merry Christmas to all!
 
Ell
@R.MartinhoFernandes 7 hours? :o wow that sucks :/
If I were you I'd just go to sleep
or try anyway
 
user142019
for (;;) asm("movq %rax, %rax");
 
2:47 PM
also, it still fails
 
user142019
dammit
 
user142019
What are the contents of main.cpp?
 
extern "C" {
    __declspec(dllimport) int __stdcall WriteConsoleW(void* hConsoleOutput, const void *lpBuffer, unsigned int nNumberOfCharsToWrite, unsigned int* lpNumberOfCharsWritten, void* lpReserved);
}

int main() {
    WriteConsoleW(nullptr, nullptr, 0, nullptr);
}
see, Clang emits a diagnostic for the wrong number of arguments.
it even quotes the whole damn declaration
so there's nothing wrong with the name, it's just the Sema API which doesn't seem to be playing ball
 
user142019
WTF. How many gazillon members does clang::Sema have? o.o
 
2:49 PM
many.
 
Ell
AccessViolationException :'(
 
@DeadMG What's with the lp crap?
 
Ell
pastie.org/5572323 <-- If anyone has 7 hours or so to spare [c#]
 
@R.MartinhoFernandes C&P from Windows headers.
 
2:56 PM
aright
I think I managed to convince Clang to code generate the LLVM Module
 
Woohoo. What does that mean?
You can compile your stuffs now?
 
it means that, in principle, all I have to do now is fix the name lookup so I can look up the correct function
and then ask LLVM to JIT the module
then in principle, I have a Wide JIT, for some rather small subset
 
user142019
Oh you want to be able to include/import C++ headers from Wide code?
 
why else would I put myself through this?
 
user142019
Do I know. :P
 
3:00 PM
lol
in principle, I should be able to interop with C++ quite tightly using Clang
but in practice, it will depend quite a bit on the arcana of their API, as I'm discovering
also I'd have to remember everything I forgot about LLVM ;p
 
Ell
doesn't that mean they have to be compiled by clang? o.O
 
well, yes
hmmm
which of Clang's code generator classes would convert from a QualType to an llvm::Type*?
ah, here we are
 
user142019
I think clang::CodeGen::CodeGenTypes, especially clang::CodeGen::CodeGenTypes::ConvertType.
 
yeah
just got it
the CodeGenModule has a function to give you an object of that type
which is fairly convenient
hmm
does the Standard specify that std::cout << x and operator<<(std::cout, x) are absolutely identical?
 
3:11 PM
@DeadMG It has member function definitions too
 
oh yeah
 
It can be std::cout.operator<<(x).
 
user142019
  switch (Ty->getTypeClass()) {
  case Type::Record: // Handled above.
#define TYPE(Class, Base)
#define ABSTRACT_TYPE(Class, Base)
#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
#define DEPENDENT_TYPE(Class, Base) case Type::Class:
#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
#include "clang/AST/TypeNodes.def"
    llvm_unreachable("Non-canonical or dependent types aren't possible.");
 
user142019
Eww, clang's code base is ugly.
 
uh, you just noticed? :P
 
user142019
3:14 PM
I have never looked into the source files. xD
 
hmm
 
user142019
One thing I really HATE about libclang's C interface is that the spelling of a type is correct only if it's a user-defined type.
 
since WriteConsoleW is extern "C", I could for now skip lookup and mangling and just support C functions
 
user142019
The spelling of void is "Void", with a capital letter. T_T
 
Ell
lol
 
3:16 PM
then what happens if you define a type Void?
 
user142019
@AndreiTita their spellings would be the same, but not their internal representations (luckily).
 
@Zoidberg'-- Since they need it to not clash with the keyword, that kinda makes sense.
 
user142019
I have to switch the return value on all the enums for the built-in types.
 
user142019
@DeadMG no, the string returned by the getSpelling function.
 
3:18 PM
oh
 
Ell
still access violation exception! (pastie.org/5572511)
 
user142019
clang_getTypeKindSpelling(CXType_Void) returns "Void" instead of "void".
 
-4
Q: string input in C and C++ using char*

user1916200Need to take string input using char*, I face this problem in both C and C++. Please help me out in both the languages separately. char* s; char t; while(scanf("%c", &t)) { if(t== **??????????**) break; *s = t; s++; } I don't know in advance as to how many characters would t...

Close as dupe.
Also, dammit, people are fucking dumb.
 
user142019
lol
 
Ell
I'm unsure as to whether to open a question or not
the question has been asked before, and my question will have a similar answer, but I can't figure out the answer to mine o.O
 
3:30 PM
hmmm
where are the libc++ headers/etc in the Clang download?
 
user142019
clang y u no link libclang Saturday it worked. T_T
 
or was I supposed to build the Standard library myself?
 
user142019
@DeadMG libc++ is in a separate repository.
 
Xeo
@DeadMG You are.
 
user142019
 
3:32 PM
aw
I hate it when they pull that shit
what use is a compiler with no Standard lib?
 
Xeo
Err, Clang's not only a compiler, y'know.
 
hmm
apparently it's not even a compiler.
 
user142019
lol
 
user1182183
@DeadMG I thought clang is a compiler, I lived in lies? wtf is it then?
 
user1182183
just a preprocessor?
 
3:36 PM
nah
a compiler has to come with a Standard library implementation, unless it's freestanding, which Clang is not
damn, libc++ won't build with CMake
 
user1182183
ah so
 
user1182183
if I srsly could choose which os I want to be able to use better at the age of 10 then I would change linux.. now what. I suck at linux stuff :p
 
Xeo
@DeadMG You just cd lib && ./buildit
 
I doubt that ./buildit is a valid Windows command
 
3:38 PM
oh, really?
 
But buildit is probably not something the Windows command line understands.
 
user1182183
buildit is not a windows internal command
 
user1182183
you have to have the program
 
yeah
 
Xeo
@DeadMG Oh, right, forgot for a second that you're screwed. :)
 
3:39 PM
it won't accept ./buildit
 
hmmm
failed to find cxxabi.h
 
you need a posix shell
msys
 
I wonder if I can fix this error myself
 
Xeo
Oh, yeah, building libc++ in itself is quite fun.
 
3:40 PM
cmake should build the source files, just not link the binary
 
Xeo
Lemme find my recent journey on getting it to compile..
 
@DeadMG You are so fucked.
 
I agree, @DeadMG is fucked. libc++ doesn't even work decently on Windows.
 
Xeo
@DeadMG You can, you just need to write the C++ ABI for Windows :)
 
or in terms of @DeadMG's "working", it doesn't work at all.
@Xeo you can lean on libgcc and libsupc++
for 32-bit.
 
Xeo
3:41 PM
hrhr
 
there is no hope for 64-bit.
 
user1182183
bytheway, how hard does someone fail if he creates a program for which you have to buy a serial.. in .NET xD
 
why is that a hard fail?
 
user1182183
well because .net applications are.. well you basicly can get the source of a .exe or a .dll without any trouble
 
user1182183
Ever heard about Red Gate Reflector?
 
3:44 PM
right
 
but that doesn't necessarily mean that you can break it so simply
.NET assemblies are protected against tampering
 
user1182183
who said I need to tamper
 
user1182183
I just extracted the serial check code
 
user1182183
and generated one LOL
 
3:45 PM
So what?
 
@GamErix How hard is it to bypass that check for any other program?
 
user1182183
for me imposible
 
user1182183
all .net programs however are easily "crackable"
 
You just google "keygen whatever".
You don't even need Reflector.
Also, fuck Red Gate.
 
user1182183
3:46 PM
@R.MartinhoFernandes ye I know there are much keygens out there almost for every app.
 
user1182183
anyway if you have a program in C or C++ or many other languages you can't just convert it back to source code
 
user1182183
and if it's in .net you can ; o
 
Why would you need that?
Assembly is runnable too.
 
hmm
I think that logically, the most secure way of doing it would be
you buy it from X's website, you give them your email address, say
 
user1182183
@R.MartinhoFernandes try to guess where the serial checking is, and, well, I tried to "crack/bypass" some serial stuff with ollydbg and I can't. so if I can do it with a application it has one of the worst protections ever :P
 
3:49 PM
then they encrypt the email address with their private key, and the encrypted address is the "serial"
 
@GamErix Why guess? There are these things called debuggers.
 
then if you decrypt it with the public key, you get back the person it belongs to
 
@GamErix Who cares if you can't?
@GamErix It is not so much a technical protection as it is more a legal and social protection.
 
user1182183
@R.MartinhoFernandes yeah righ :x kinda wondering why there will never be something uncrackable :p
 
Technical protections are often inconvenient for legitimate users and unseen by illegitimate users.
@GamErix Because the user can run whatever the heck they want on their box.
 
user1182183
3:52 PM
@R.MartinhoFernandes even if you would make in each function a check if the exe size, assembly and memory is not changed? XD
 
Xeo
Alright, time to meet the family for Christmas, I guess...
 
@GamErix WTF, that's never going to work.
 
@GamErix I can just run the same code with the check.
 
even if you hashed your whole executable, the user could just change the hash to the new hash value.
 
As long as I am running your code on my machine, you have no chance.
 
user1182183
3:54 PM
@R.MartinhoFernandes so it's not possible like "Memory has been changed by external application.. shutting down"
 
Xeo
ITT: Programs should not be allowed to be installed locally anymore, to protect from tampering.
 
@GamErix Nope.
 
@GamErix I can just run the same code without that check.
 
as long as it's my CPU executing, I can make it execute whatever I like
and you can write whatever you want, and I can just remove or change whatever I want
 
user1182183
yeah true ;F
 
3:55 PM
@Xeo That is the most effective solution. Why do you think these always online DRM crap schemes keep popping up.
 
Xeo
@R.MartinhoFernandes Aye, it was meant half-jokingly only.
 
user1182183
@Xeo but hey that would only work if there would be large servers with many bandwidth (we do have that) and everyone on a 1 gbps connection (not everyone has that)
 
Xeo
Anyways, afk.
 
Why a 1gbps connection?
 
user1182183
@R.MartinhoFernandes how do you want to run a 15gb game on a 100mbps connection
 
user1182183
3:56 PM
going to take hours
 
@GamErix WTF, why are you assuming you will download the whole game?
That brings you back to square one.
And things like games need low latency above all.
 
hmmm
why did I put a breakpoint on a breakpoint?
 
user1182183
@DeadMG so you can announce breakception
 
@GamErix On this hypothetical scheme the application is not supposed to run on your machine. You only get its output and send back input.
It will probably always suck because of latency.
 
user1182183
@R.MartinhoFernandes well, a HD image at a rate of 60 fps is 492480000 bytes / sec
 
user1182183
3:59 PM
is 470 MB /s
 
oh, by the way
I do have Rubenvb's MinGW 4.7
 
@GamErix There is this thing called video compression.
 
can I configure Clang to use it's libstdc++ for Windows?
 
user1182183
(32 bit = 4 bytes) x (HD = 1900x1080) x 60
 

« first day (800 days earlier)      last day (4164 days later) »