« first day (589 days earlier)      last day (4585 days later) » 

16:00
If an employer really thinks C is faster than C++ in any meaningful way, for instance, it might indicate that he or she thinks premature optimization is okay.
Because then, oh hell, assembly is faster than C! Let's start doing assembly!
actually C-style code (aka bad code) is faster than C++-style code (aka good code)
@Abyx Not in any meaningful way.
Unless you're talking about writing C in a .cpp file.
And even then I'm not really sure.
user784668
@Abyx [citation needed]
it's just an experience
Even if C were faster than C++ in any way, it's pointless. C++ wins because of the paradigm shift, the way it offers solutions for development and maintenance of huge modern projects. C would be "just as slow" if it were actually useful in the modern world of software engineering. C just has a potential for more crashing and burning in the fire of errors and eternal debugging.
thb
thb
16:03
I think that you must be right. I seem to remember reading -- oh, ten years or so ago -- Linus Torvalds' expressing dismay about the unnecessarily slow code C++ programmers were prone to produce. I do not know what Linus said that, because like you I prefer C++, but I would not assume that Linus were wrong.
@Abyx Anecdotal evidence is not evidence.
I don't care for a Lamborghini which is ripped of all luxuries, even if it can go 300 km/h. I'd rather have a beautiful Audi which gets me to the destination in style.
The speed limit is 130 km/h anyways.
@thb I would.
@thb Torvalds is well known around here for talking out of his ass.
Linus Torvalds is a worthless loser
2
user784668
16:04
@DomagojPandža Germany.
And also, going into a turn with a Lamborghini makes you wonder whether you're getting out of it alive. With an Audi, you feel safe. And everyone else onboard feels safe.
@DeadMG I wouldn't go that far. But when it comes to C++, he does not have the sufficient credentials to formulate any opinion.
thb
thb
@EtiennedeMartel: Does an example of Linus' talking come to mind?
@thb A rant was linked here a few days ago. Most of his arguments were either ad hominem or 20 years old and no longer relevant in the context of modern C++11 code.
That seems to show that he doesn't care enough in the language to actually try and update his arguments.
So whenever he starts whining about C++, we just dismiss what he says, because he might as well be ranting about Pascal for all it's worth.
It's like he doesn't even live in the same dimension.
@EtiennedeMartel This.
user784668
16:10
@EtiennedeMartel PHP is faster than assembly!
also C++ sucks because of lack of std::small_string, std::fixed_length_array and a lot of other data types
TL;DR: if you want to blast something, at least make sure you know what you're talking about, because otherwise you're just a hater, and haters are not allowed to say what they think.
std::array.
@Abyx SSO comes in every std::string implementation now.
also, std::array and boost::array.
@CatPlusPlus I meant non-resizeable dynamic array
user784668
16:12
@DeadMG libstdc++
also, just write your own if you want it so much, not every lib has to come as Standard
I thought about this, and I think that basic_string should have been typed on an encoding rather than a char_type + char_traits pair.
@Abyx Not really useful.
std::vector and don't resize.
Can you really use that as an argument against C++?
user784668
@Abyx std::vector
16:13
If it isn't there, it's most likely trivial to implement on your own.
@DeadMG it's not like small_string<N>
Or std::unique_ptr<T[]> really.
Just use std::vector.
@Abyx Yeah, because someone smarter than you picked a value of N using data you could never have access to.
and again, just write your damn own if you want it so much.
@CatPlusPlus pair<unique_ptr<T[]>, size_t>
What would small_string be better in?
16:14
C++ goes hand in hand with the standard library. If you're not using it, you're doing it wrong.
End of story. Reinventing the wheel is stupid in all scenarios, except experimental.
@CatPlusPlus it's for "premature" optimizations
What would it be better in?
user784668
I want a small_vector.
thb
thb
@JohannesSchaub: I see your May 12 comments on the subject. If you happen to be online, do you disagree with Etienne?
really_small_vector.
thb
thb
16:17
What Etienne writes makes sense to me, and it also accords with my experience; but then unlike you I like unit tests, so maybe there is something I am not understanding here.
infinitesimal_vector (d_vector)
user784668
Yes, I know I can write one myself. But I'm still confused when it comes to writing move constructors and assignments.
this_vector_is_so_small_it_does_not_exist
@CatPlusPlus there_is_no_vector.
well.. instead of small_string<N>, one can use a custom allocator<N>, but it's not trivial
thb
thb
16:18
And I am reluctant to agree that Linus is unreasonable, even though I cannot actually argue in his favor in this instance.
In fact, let's have a distinct type for every possible size.
MAXIMUM OPTIMISATION!
this_vector_is_so_small_it_does_not_exist < planck_length
OPTIMIZE ALL THE EDGE CASES!
vector_1, vector_2, vector_3, ..., vector_N.
user784668
@CatPlusPlus It's called array.
16:19
where N tends to infinity
My toilet doesn't flush properly. I find that incredibly aggravating.
@Fanael No templates, hand-written code is the BEST AND OPTIMISED.
user784668
@CatPlusPlus The best and optimized code is the best and optimized.
@EtiennedeMartel Don't flush it then?
I still don't know what would small_string do, exactly.
Other than being small.
16:20
It can only store lowercase letters
And I imagine that when it grows it throws "sorry, cannot grow, I have a condition" exception.
thb
thb
For example, I tend to agree with Linus that the overuse of debuggers leads to sloppy code. Evidently, in Linus' mind, the debugger and the C++ compiler are somehow related, or rather they produce related bugs.
What's "overuse of debuggers"?
@EtiennedeMartel Transferring ownership of shit from oneself to the toilet is one of the rare pleasures in life. And when the toilet fails to properly deconstruct one's previous shit, it indeed is aggravating.
16:21
> SmallString - A SmallString is just a SmallVector with methods and accessors
I called it.
Wait, no, I didn't.
Dammit.
Alright, don't plink me guys, I'm gonna do some D3.
Belial on Hell isn't gonna kill himself.
thb
thb
@CatPlusPlus: Let me see if I cannot find the reference to Linus' remarks on debuggers.
@EtiennedeMartel Okay.
I don't want to read any more of Torvalds' rants, thanks.
Torvalds is a monolithic pussy.
Not even the one about how cool CatPlusPlus is?
16:22
No.
Cat Plus Plus isn't insecure about his coolness factor.
> Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire
Also, chicken paprikash.
And I thought OOP was silly
No fun in OOP.
16:26
You can't spell poop without oop.
And feces without C.
Also ExCrement.
And scat without cat
thb
thb
Here is Linus Torvalds on debuggers: [lwn.net/2000/0914/a/lt-debugger.php3]. For what it's worth, my own experience tends to confirm Linus', but maybe that's only because my overall mental model happens to parallel Linus' in this instance. (Unlike Linus, though, I still happen to like C++.)
> The requested URL /2000/0914/a/lt-debugger.php3] was not found on this server.
That's a strange attitude towards debugging.
404 attitude not found
16:29
There was a programmers.se question about debugging and the upvoted answer said debuggers are worse than self-debugging.
Is removing brackets that hard?
user784668
@Pubby lol, can haz link?
Yes, removing brackets requires inhuman intellect.
"Because I'm a bastard, and proud of it!"

Yes, pretty much sums it up.
75
Q: What's the benefit of avoiding the use of a debugger?

jonathanOver the course of my career, I've noticed that some developers don't use debugging tools, but do spot checking on erroneous code to figure out what the problem is. While many times being able to quickly find errors in code without a debugger is a good skill to have, it seems it's less producti...

thb
thb
@Pubby: Thanks.
16:31
Searching is not that hard either ;)
Or maybe I just have an inhuman intellect
thb
thb
Regrettably, I am new to the forum. Here is the Torvalds/Debugging URL again. Hopefully it comes through cleanly this time: lwn.net/2000/0914/a/lt-debugger.php3
user784668
@thb Torvalds. lol
And quite frankly, I don't care. I don't think kernel development should
be "easy".
He's just full of shit. He actually condones shooting oneself in the foot, just not to prototype a bit faster.
I just like geniuses who think writing code in Microsoft Notepad is hardcore.
Equalized easily with such mental ideas.
Also, I think we should start building processors by hand.
You know, machines are for pussies.
user784668
@thb And the tl;dr is?
"I built a CPU with a screwdriver and nothing else!"
Who needs semiconductors.
They make it too easy.
user784668
16:42
@CatPlusPlus That's lame. I built a CPU with a potato and nothing else.
Potatoscale.
2
You built the portable GLaDOS?
thb
thb
I am not interesting in mocking Linus Torvalds, sorry. This conversation is probably not for me, and I probably shouldn't have gotten involved in it. Thanks, anyway.
Nobody is mocking anyone, he's mocking himself. Making such statements is a child's errand. We design computers because we're unable to do what they can do in a nanosecond.
Why the hell should we not use them to help us out?'
We're mocking everything.
Writing a kernel might make you an expert on kernels, but does not make you an expert on all things programming and CS and butter.
16:44
True dat.
And I'm out of tea, NOOOOOOOOO.
And although I have great respect for the linux kernel and everything that has Linus done, some things are plain wrong.
user784668
@CatPlusPlus "might". True.
Albert Einstein couldn't deal with quantum mechanics. Doesn't mean quantum mechanics withered and died.
> The THX sound was 20K lines of C code on a mainframe
16:47
May 20 at 16:45, by LearningSlowly
I mean if one can write a Game. He would literally be able to do everything possible rite ?
:P
I write games and I'm going to be the president of Uganda one day, you'll see.
And my mum thinks I'm handsome.
16:59
Write a thermonuclear war game and maybe you will
17:12
lol
I suck at TeX.
Everyone does to some extent.
user784668
You suck at sucking at TeX.
In fact, I don't.
I'm the world champion in sucking at TeX.
17:51
lol now I already have 24 keywords while I had only 21 a few hours back
C++ has 84 keywords. D:
18:05
What 24?
I mean, show 'em.
bool byte cast catch copy ctor dtor else external float if int import move no pure resource return semi size of this throw try weak yes
Types don't have to be keywords.
Also no and yes?
18:07
@CatPlusPlus Boolean constants.
Just to say it: A compiler is allowed to reject (or do anything else) a file containing the usual "hello world" code because of too long lines. That's undefined behavior then. I wonder why you have no clear statement in your answer about the consequences of violating the "long lines" limit... — Johannes Schaub - litb May 12 at 9:34
They don't have to be keywords, either.
What would they be else?
Constants. Duh.
18:08
a type is never a keyword
that statement wouldnt even make any sense
Haskell has 12 keywords, unless I'm forgetting something.
Hmm I will put them in a different section then.
Fundamental types or something.
No, more, I am forgetting stuff.
type specifiers may be keywords
We're not talking about C++.
18:12
this is semantics
Fixed it. Thanks for the remark.
Wait, bool, byte, int and float are type specifiers.
18:31
hello all, been a while, computer exploded
is anyone good with recursion
question: I'd like to start up some serious C++11 work (code some challenging complicated stuff using as many C++11 features as possible to prime myself on them) - I can't decided between Clang, GCC, and VC11 (haha!). I'm going to be doing it on Windows and would appreciate an IDE; not sure how Clang stacks up with IDEs. so, what do you think, which should I go with?
@JohnSmith yes.
@JohnSmith ask and ye shall be answered
I am trying to code something that will accomplish a task i asked in another thread: math.stackexchange.com/questions/150449/…
i figure it is recursive in nature but i do not know how to go about implementing it
> So what loop does is it takes the output d and wraps it around back as an input. So the coroutine ends up receiving as input the value that it will itself produce in the future.
My brain is boiling.
given a list of k's I want to calculate the coefficients of an expansion
18:34
@CatPlusPlus coroutines are fun :-P and can be implemented handily wqith setjmp and longjmp. that is the only valid(ish) reason to ever use those (and usually there are better ways)
@stdOrgnlDave VC11 fails. GCC works better on Windows than Clang. At least that was true a while ago.
@stdOrgnlDave It's not just coroutines, it's FRP.
@CatPlusPlus clang can be built on VC2k10 now...
And arrows.
And recursive arrows.
@JohnSmith Do you know how to implement recursion?
@JohnSmith do you have any ideas about how the algorithm might work?
18:35
factorial 1 = 1
factorial n = n * factorial (n - 1)
-- If my Haskell is still as good.
some ideas
but not sure about the best way to handle it
i need to basically iterate from 1 to k_n for all my k's
factorial = foldl (*) 1
:P
factorial n = product [2..n]
and check if the product of that result is equal to my target
Many possible ways.
18:36
if so, add to counter
Right, needs to produce [1..n] first.
the end count will be the coefficient
product is foldl (*) 1 anyway.
can I do it in template metaprogramming?
argh, brb
i mean normally it'd look like this right, say if I had three k's
for a in range(1,k1+1):
 for b in range(1, k2+1):
   for c in range(1, k3+1):
     if a+b+c==target:
       coeff+=3
18:41
So, what's the issue, really?
i dont know how to implement it]
to work for any number of arbitrary k's
Three nested loops are equivalent to one loop iterating over list of a Cartesian product of three sets. That's trivial to generalise to N loops.
Start with template<unsigned N>.
what do you mean cpp?
Your code could be:
18:44
the k's are arbitrary
@JohnSmith This is a C++ room, IIRC.
this is more of an algorithms question, i can code it in C++ just the same
for a, b, c in itertools.product(xrange(1, k1 + 1), xrange(1, k2 + 1), xrange(1, k3 + 1)):
    if a + b + c == target:
        coeff += 3
but there are potentially any number of k's
Generalising more, you only need a sum, so you don't need to unpack the tuples:
18:45
i.e. a,b,c,d,e
user406009
@JohnSmith Just use recursion.
for x in itertools.product(...):
    if sum(x) == target:
        coeff += 3
which is why i was wondering about recursion
that is what i came in here asking about @Ethan
i do not know how to properly set it up using recursion (I figured it was a recursive issue)
Generalising more, you can generate a Cartesian product of N sets:
N = len(ks)
for x in itertools.product(xrange(1, k + 1) for k in ks):
    if sum(x) == target:
        coeff += N # or is it constant 3? haven't read the mathy question
No need for recursion.
it would be N yes
18:49
This code does the same thing your first snippet does, except for N ks.
hm it does not like if sum(x) == i:
TypeError: unsupported operand type(s) for +: 'int' and 'xrange'
(in my program the target is i)
Oh, right. Bit different:
N = len(ks)
inputs = [xrange(1, k + 1) for k in ks]
for x in in itertools.product(*inputs):
    ...
no error this time but wrong result
does this look through all possible combinations
or just all first elements, all second elements, etc
user406009
Haven't used python in a while, but wouldn't the recursion approach be something similar to:

def foo(current, list, target,i):
   b = list[i]
   val = 0
   for num in xrange(1,b+1):
       sum = num + current

       if len(list) == i+1:
           if sum == target:
              val+= 3
       else:
          val+= foo(sum,list,target,i+1)

    return val
It's a Cartesian product.
Add print x and you'll see the inputs.
user406009
18:54
Cat's idea is better though
Recursive version will quickly exhaust recursion limit.
yeah when i try this intertools thing for the 100 case it returns 2
should return 3
because k list here = [1,2] and [1,2]
err
sorry [0,1,2]
(1+x+x^2) * (1+x+x^2)
=1+2x+3x^2+2x^3+x^4
coefficient of x^2 (target=2 in this case) is 3
Pepsi cola y u no taste.
figured it out
i have to add 1, not N
and start from range 0 to k
thanks so much cpp
tested it out now, seems to work fine
19:15
OH MY, a library for rendering text that uses only core OpenGL.
Ell
Ell
19:26
hi guys
Ell
Ell
boy am I tired
Go to sleep then.
Ell
Ell
im too tired to sleep
I'm not; sleeping is a waste of time.
Ell
Ell
19:41
how does 2d with 3d usually work?
2d image on texture, then texture on faces displayed in orthographic style in front of camera?
@RadekdaknokSlupik and a broken record :)
hey can someone help me with a issue
is "abcdefg" the smallest one in Lexicographical order?
im trying to generate premutation but i need the smallest one
The sorted is the smallest one, so yes.
Just like 000000 is smaller than 000001.
so is "abcdefg" smaller that "aaaaaaa"
No.
Like 000000 is smaller than 012345.
19:50
b > a.
Lexicographical comparison is "compare first character, if different then (x > y ? greater : smaller), otherwise compare second character, ...".
so can i start with "aaaaaaa...."
aaaaaa, then aaaaab, then aaaaac, if that's what you mean.
yeah yeah
after aaaaaz comes aaaaba, aaaabb, aaaabc etc
user406009
But those are not permutations of each other.
19:52
oh you want permutations of abcdefg?
yeah
#include <algorithm>
#include <string>
#include <iostream>
int main() {
    std::string s = "cbadgf";
    std::sort(s.begin(), s.end());
    do {
        std::cout << s << '\n';
    } while(std::next_permutation(s.begin(), s.end()));
}
from the smallest to the greatest
Note that I sort the list first (which gives the first permutation in lexicographical order).
o thank you
know i understand
user406009
19:53
@nEAnnam MIght want to try looking at this site too(en.cppreference.com/w/cpp/algorithm/next_permutation)
sort -> than generate next permutation
You're generating permutations, who cares about the order.
To have an order, you have to generate all permutations first.
If you want to get all permutations using std::next_permutation, you need to sort it first. Otherwise you only get a part of all permutations.
Oh, next_permutation hold lexicographical order. Nevermind then.
i want to generete all posible strings of "abcdefg" in lexicographical order
19:55
Then use the method I gave. Piece of cake.
o thank you very much then all of you
Result is here: ideone.com/KDeIP.
No problem.
cya and have a nice day guys
20:34
Whoa. this is a nice product but WTF is up with their privacy ignorant idea of listing all 929 sales transactions with name, country and inventory ordered!?!
I've just read something about this kid Shouryya Ray who supposedly found an equation which describes the trajectory of a thrown ball and how it bounces off a wall, which "has been a mistery for over 300 years". The fuck? We've been doing that for hundreds of years, application of a little linear algebra and conservation laws.
Are the news retarded or am I missing something?
Is this something like the raspberry pie @sehe ?
apparently. I didn't make it :)
@DomagojPandža Probably both, wit a causal connection
(The news is retarded, therefore we miss crucial information)
@DomagojPandža I can't find any details about it at all.
I am just looking at my equations which simulate physics in my engine. And they are so straightforward and easy to derive. It's almost effortless. Sure, you can't account for dynamic variance of media density and other factors which are simply hard to quantify, but in the end, entire Newtonian mechanics are nothing but a macroscopic approximation.
We use powerful computers to actually simulate those hard factors in order to predict with a higher precision, but you can't write the dynamics of the world as a simple equation.
20:45
> Problem posed by Newton more than 300 years ago
That's the point, there are so many factors it falls into chaos theory.
the only news article to be found is "Boy solves equations"
And Newtonian mechanics approximation applied with conservation laws provides an admirable, yet simple approximation.
Seriously, it's insulting.
I have a feeling that the boy isn't fullblood German; that name doesn't ring very Germanic, to me
He's from India
20:46
> The Indian-born teen said he solved the problem that had stumped mathematicians for centuries while working on a school project.
Yup just found that
WHAT PROBLEM?
It looks really cool :O I knew it wouldn't be long until someone else jumped in to the market.
Everyone just writes stupid shit without qualifying to get media attention.
Throwing balls and determining their trajectory and bounce characteristics is simple. Can't be it.
apparently it has something to do with fluid resistance being calculated much more accurately
My mother asked me to make a library management application, should I do it in Cpp or in Python?
20:49
whats a library management application? Like books?
@DomagojPandža or air resistance, from another source:
> Newton posed the problem, relating to the movement of projectiles through the air, in the 17th century. Mathematicians had only been able to offer partial solutions until now.
@Edoardo Use Lotus 1-2-3
> “The flight of a ball is classical Newtonian dynamics —all we need (to describe the motion) is the angle at which the ball is projected and the coefficient of elasticity which describes the interaction of the ball with the wall,” said K. Subbaramaiah, an executive member of the Indian Association of Physics Teachers.
@Jeremy Yes.
And air resistance is trivial. The only way to have precision is to account for so many factors that only a computer can help. Or simply approximate it.
There's nothing in between.
Honestly, I'd say you very much need to not reinvent the wheel. Especially since you are asking what language to use.
Steer clear from C++ if you can't get that decision down for yourself
20:51
@Edoardo, I would stick to HTML, PHP and mySql for databases. The advantage of this is that other machines can browse the state of books in the library. Further, no software updates (which can be a pain if you are managing several computers used by your users)
It depends on so many factors, you cannot improve its accuracy, it's beyond human. Either approximation or a very strong computer model.
At least all library management systems I've seen have been php
Mathematics simply boils down to averaging. When you measure density, math has implicitly made every volume to contain a certain mass, equal across the board. Which is in itself an idealized approximation.
@Jeremy I challenge the assumption that software needs to be written. Quality software exists, and I wager a fair bit of free, opensource software will be available precisely in this field. (@Edoardo)
@sehe has a good point too.
You might not even need to write one, unless you are just looking for a personal project to work on.
20:54
The problem with reinventing wheels is that, frequently, the user ends up with a poor substitute of the real deal. And the thing gets tossed since the original developer loses interest/dies/move to another city etc.
Mine would be a personal project with no time restriction.
@Edoardo Well, you intend to live forever? Of course there is a time restriction. Also, motivation is a scarce resource
Computer models are actually the future of actually accurate, non idealized physics. Has been since von Neumann and the squad at the Manhattan project turned to probability theory and developed the Monte Carlo method to calculate nuclear particle trajectories and penetration range following a detonation. I've personally, like many others, managed to apply this statistical approach to global illumination.
What is the target audience? Is this a real (say municipal) library?
I really need to find out what's this about.
20:55
Well, you should look in to using some libraries - I'm sure there are tons out there, as sehe said. Maybe leave the most impressive components up to yourself so you can put it on a resume or something.
@DomagojPandža Go!
@sehe It's for my mother.
WTF? Cats better than dogs? What have people here been smoking?
Catnip?
@Edoardo Well. That doesn't answer the question. What kind of library does she manage?
@RMartinhoFernandes It was only @RadekdaknokSlupik who said that. Have mercy on his young soul
Programmers and cats go together like bread and butter.
20:57
(by the way, cats are of course a lot nicer than dogs, precisely because they are less advanced - they require less confirmation and guidance, lessay: communication)
My cat is simply an inspiration to our global effort of procrastination.
(that, and walking)
@DomagojPandža "global" is on the front of your temporal lobe now
Sorry @sehe, my english is very poor...
Is it going to be used by just your mother?
@Edoardo That's no problem. I can probably get what you say in another language. I really mean: "how big is the library" and "how many people will be using your program"?

« first day (589 days earlier)      last day (4585 days later) »