« first day (598 days earlier)      last day (4352 days later) » 

2:00 PM
same as any other malloc call
 
@TonyTheLion cannot convert void * to unsgined char *
 
@CatPlusPlus :)
 
What's this malloc thing?
 
@Abhishek you're doing it wrong then, post your code
 
@sehe I thought that still left a really complicated legal area of "derived works"
 
2:00 PM
@RMartinhoFernandes it's some evil nonsense invented by evil old progammer dudes.
 
but who uses malloc anyways?
 
C people
 
@Abhishek Instead of dynamically allocating memory, declare a vector with the right size.
 
  unsigned char * buffer;
  buffer = ( char *)malloc(buffer_size);
 
it's something like the mole people
 
2:01 PM
Sigh.
 
( char *)malloc(buffer_size); should be (unsigned char *)malloc(buffer_size);
 
@Abhishek It should be std::vector<unsigned char> buffer(buffer_size);
 
^that
 
@Tony, stop giving him wrong advice.
 
and technically the cast is unnecessary, but I'm not sure that MSVC accepts it
however, in C++. you don't do that nasty malloc shit
 
2:02 PM
@TonyTheLion It is necessary.
 
I've been told, almost every time, that I shouldn't do it
 
It's only redundant in C.
 
@RMartinhoFernandes In C it's not necessary. In C++, the whole thing is wrong.
 
@RMartinhoFernandes ah I see, that's where the confusion comes from
 
@TonyTheLion In C, you shouldn't. In C++, though, it won't even compile.
 
2:02 PM
An unsigned char, that's a new one.
Especially a signed char
 
Isn't casting the return of malloc a no-no?
 
In C.
 
The malloc itself is a nono.
 
@SamDeHaan Only in C. Try compiling it in C++ though.
 
@EtiennedeMartel that's what I kept running into, cause I was using a C++ compiler
 
2:03 PM
In C++ you can't assign void* to T*.
 
@SamDeHaan not when writing new
 
new is not malloc.
 
@Abhishek are you writing C or C++?
 
C+, of course.
 
2:03 PM
C++
 
Both!
CC++
 
There you go. Drop the malloc, use standard containers.
 
mpg123.de/api/mpg123__to__wav_8c.shtml <- that api example is in C
 
The cat broke.
 
2:04 PM
@Abhishek So what?
 
on there they use malloc to allocate the memory .
 
@Abhishek then, yea, don't use malloc, just use std::vector<unsigned char> like @EtiennedeMartel suggested
 
you say in C++ i shouldn't use malloc
 
C is not C++.
 
2:05 PM
Okay then i will try that :-)
 
C++ is not C.
 
malloc is a C construct
 
Don't use new either unless you have to.
 
and not C++
 
Cows are not here.
 
2:05 PM
They look like each other, but they're not the same.
 
There are no cows.
 
C is C++'s evil twin.
 
@Abhishek stackoverflow.com/a/7970036/168175 is my view on that
 
Or brother.
 
Yep. vector is a standard container that allocates a block of contiguous memory (essentially, it's an array that grows). One of its constructor takes a size, so you can use that to declare a buffer (and then use &buffer[0] to get a pointer to it).
 
2:06 PM
And with C++11 magic, you can even benefit performance-wise with move semantics which don't deep copy unnecessary shit.
 
&*buffer.begin(), 'cause it's so pretty.
 
Compile time error :P
the library requires char *
:-|
 
Well, then, use vector<char> then.
 
@CatPlusPlus buffer.data()? &buffer[0]?
 
Well, it's the shit at the beginning dereferenced, so the address of that shit.
Shit works so well with arbitrary stuff.
 
2:09 PM
I use "stuff" and "thingy" usually.
 
The top wingy bit.
 
I prefer "shit".
2
 
Reminds me that I don't really want to touch it since I don't know what it is :Đ
So, shit it is.
 
@RMartinhoFernandes That's not pretty, obviously.
 
Obviously.
 
2:11 PM
@RMartinhoFernandes That thingy.
 
Martinho has no sense of code aesthetics.
 
Wut.
My code is beautiful.
 
No, your code is fabulous.
 
Ell
"Shit" is unnecessarily crass IMHO
 
And for some, it sucks donkey's dick.
 
Ell
2:13 PM
see just "sucks" would have done there too :P
 
We're all adults here.
 
Well, he's not.
BAN HIM.
 
@Ell No, it wouldn't. That would mean it "sucks" less than it does.
 
Pitchforks and shit.
 
THROW HIM TO THE LION(s).
 
2:13 PM
They're not completely interchangeable without losing some of the intended meaning.
 
THROW HIM TO TONY
 
But really, it's silly. It's words. And the reaction people have to those words is what makes them so damn funny.
It's like a portable outrage generator.
 
Relevant ^.
 
Ell
yeah I'm not offended by them or anything I just don't think they are necessary
 
@DomagojPandža Was that random or do you have some actual thing to point out? (I'm fine with either, really, just curious)
 
2:15 PM
@Ell Watch that video. Stephen Fry even talks about that "necessary" argument.
 
@RMartinhoFernandes It was just an add-on on Cat++'s joke. No harm intended. :Đ
 
Urgh, this is difficult. I thought that it would work to have new constants constructed with references to their dependencies, and when a constant is added to the container its dependencies are also recursively added (if they don't already exist). Concrete indices are figured out later, when the container is actually compiled to a file. But then when constants have to have knowledge of the container they're in, and that's ugly.
 
whoos i need stl :-x
 
Ell
@EtiennedeMartel good point he makes there
 
2:18 PM
\
 
@Abhishek You're lucky then, it's just an #include away!
 
One #include a day keeps compiler away.
3
 
its not installed on my system [fedora 17 fresh installed]
 
2:20 PM
What.
If you have a decent compiler, you have a standard library.
Those two ships together.
 
Standard library comes for free.
C++ without a standard library is just C on steroids.
 
downloaded
i d k
 
downloaded?
 
0
Q: Best way to draw a chevron diagram using Tikz

SoulyI want to visualize the transition from a state A to B by doing different operations x,y,z. I want to achieve something similar like this: ________ ________ | | ____ _____ ____ | | | | | \ \ \ | | | A | | x | y  | z ...

 
it just wasnt installed so i dwnloded stl
 
2:21 PM
Yes, ASCII visualisation helps a lot here.
 
Erm.
What do you mean "wasn't installed"?
 
@Abhishek What compiler are you using?
 
What, GCC doesn't come with a stdlib now?
 
Shit Studio 11?
 
so when you use malloc (yes I know you shouldn't use it) on a non-POD type, what can go wrong?
and how does new handle it differently?
 
2:22 PM
gcc
 
Impossibru.
 
when i tried #include <vector.h>
it failed to find
 
There's no vector.h.
 
#include<vector>
 
There's only Zul.
@TonyTheLion No ctor.
 
2:23 PM
oh the ctor is not called?
 
You have to do malloc/placement new combo.
 
../hello.cpp:72:52: error: cannot convert ‘std::vector<unsigned char >’ to ‘unsigned char*’ for argument ‘2’ to ‘int mpg123_read(mpg123_handle, unsigned char*, size_t, size_t*)’
 
How would it be? malloc is like operator new, it only takes a size and returns a pointer to a buffer.
 
Vector contains an array, it itself is not an array.
 
@EtiennedeMartel Yes, it does. I'm pretty sure Fedora 17 doesn't ship anything older than 4.5.
 
2:24 PM
I was interested to see that (on my Linux system) vector (with no extension) is an actual file. I assumed that GCC would map it to a vector.hpp.
 
Why would it do that?
It'd require special casing or whatnot, and is relatively crapload more work than just naming the file like it should be named.
 
@CatPlusPlus For general madness. What else.
 
I suppose.
 
Most of the implementation is kept in bits/ anyway.
 
ah I see
 
2:25 PM
@Abhishek If your compiler and stl are relatively recent, vector.data() should work
 
and what about when your type has a virtual function, I guess malloc would also mess that up?
 
Extensionless headers suck, because you have to add modelines for editors.
 
@discreteGenius: technically, that's not a literal. 10u is a literal, and then it calls operator-() on it.
 
Do you often edit vector?
 
malloc... getting down and dirty i see
 
2:26 PM
virtual is pretty much irrelevant. sizeof(T) already includes the size of vtable, if there's any.
 
Editing vector is pointless.
 
You have to call ctor either way.
 
Thanks guys
 
Object is unusable until you call the ctor.
 
2:27 PM
Ctor must be the name of my next character.
 
can you guys link me to good resources for C++ , last time i did C++ was 2 years ago in college
 
@Maxpm Why would I?
 
Mighty Ctor.
 
i wanna learn it :-|
 
1200
Q: The Definitive C++ Book Guide and List

grepsedawkThis question attempts to collect the few pearls among the dozens of bad C++ books that are released every year. Unlike many other programming languages, which are often picked up on the go from tutorials found on the Internet, few are able to quickly pick up C++ without studying a good C++ book...

 
2:29 PM
ah I see, well it seems I finally understand POD types
took me a while :P
 
Bottom line: don't use malloc, ever.
 
got it :-)
 
@CatPlusPlus intredasting, I didn't know that
 
I can't imagine a good reason to use it.. unless you have to implement new?
 
Or not using C++
 
2:31 PM
With or without C++, I can't live, with or without C++. And you give your code away, and you give your code away... And you give... And you give... And you give your code away. My compiler's bad, my IDE bruised. My project got me with nothing to win and nothing left to lose.
 
Rule of thumb: if you want to do something "the C way", check if there's a better "C++ way" first.
 
There are better custom allocators than libc malloc.
 
Thank you very much for the resource @CatPlusPlus
 
Dumb question but why would anyone use C over C++
 
@Collin if you call a C library you might need to use it. But that's pretty shoddy design on the part of the C library still.
 
2:32 PM
First word answers your question.
 
So far i was living with JS >_< and 2 years of JS has totally made me forget c++
 
There's no C++ compiler available.
 
Why would one use a fork instead of a spoon
 
@Abhishek If you want a reference, don't go to cplusplus.com, go there instead: en.cppreference.com/w/cpp
 
Can't C++ do anything C can do?
 
2:32 PM
That's about it.
 
@EtiennedeMartel :-)
 
The question is meaningless
 
user784668
Why would anyone use brainfuck over Befunge?
 
@AgainstASicilian ask Linus...
 
Semantically void.
Meaningless.
Fruitless.
 
2:33 PM
C is still used a lot in embedded development.
 
Not that only
Kernel development
 
But is it technically better than C++ in some ways?
 
No
It's different
 
lib development
 
What provides the difference in utility?
 
2:33 PM
It's smaller. Whether that's good or bad...
 
objective-c is a superset of c
 
Lighter
 
@AgainstASicilian Apparently it's to keep the idiot C++ programmers away. I use it for a lot of embedded work where lowest common denominator is important
 
@Nils and as I understand it is strictly a superset unlike C++
 
less complex, that's always good
 
@awoodland exactly
 
Is embedded development stuff like microcontrollers and hardware components?
 
@Nils Not sure I agree with that. Sure, C++ is strictly larger, but the code can be much less complex in many cases
 
@Nils But less expressive isn't.
 
@AgainstASicilian yes
 
2:34 PM
Technically, they all dissolve to the same low-level machine code. It's different from a human perspective, C++ offers better ways of conveying stuff we want the computer to do.
 
lean/less-bloated high-speed operations
 
user784668
C code can be potentially faster than C++ code compiled with the same compiler in heavy number crunching, because C has a standard way to tell the compiler to assume that pointers don't alias.
 
@AgainstASicilian Yeah, and even there, many platforms comes with a good C++ implementation
 
2:35 PM
@Fanael not much
 
oh noes, the C vs C++ argument
 
@Fanael did restrict not make it into C++11?
 
I find this rather impressive, I mean I would probably fail miserably when trying to do my own gui.
 
user784668
@awoodland It didn't.
 
16
Q: Does C++11 add the C99 restrict specifier? If not, why not?

Billy ONealrestrict is a C99 feature which is getting a lot of attention lately by allowing the compiler to perform "previously-fortran-only" optimizations to pointers. It's also the same keyword announced by Microsoft recently to be the underpinnings of the C++AMP specification. Is that keyword actually i...

interesting
 
2:36 PM
Writing basic UI is not that hard.
 
have you looked at it
 
The hardest part is probably focus handling and text rendering.
Text rendering with OpenGL is a nightmare.
 
But nobody cares about a basic UI. Creating a basic spacecraft is easy, but useless.
You need to feel the nightmare in order to emerge victorious!
 
UI is overrated.
 
No
 
2:37 PM
yes but to not make it suck you need to be able to declaratively (xml) do the layout and stuff
 
UI is not a programmer's job
 
Fancy animations might not be easy.
 
@TonyTheLion You're overrated.
 
@TonyTheLion USB ports for all!
 
UI is not a programmer's job?
 
2:37 PM
@Cicada look at the xeceretcode page
 
And text fields next.
 
@Cicada I beg to differ. I'm doing UI right now.
 
@Cicada making the ui work is
 
@RMartinhoFernandes wut? I don't see the relation?
 
There's nothing amazing about that linked UI.
 
2:38 PM
UI is programmer first, artist last.
 
Ell
UI is a user experience person's job? o.O
 
And using XML is stupeed.
 
@EtiennedeMartel no I'm very underrated :P
 
user784668
@Cicada In the best case, like eight times faster, as in AVX-vectorized code versus scalar code.
 
Sorry but UI requires very particular artistic / ergonomic skills, which are not the programmer's main skills
 
2:38 PM
UI design.
 
Ell
@CatPlusPlus what language should we use for gui layout?
 
UI programming and UI design are two completely different things.
 
There's a difference between the UI technical design and visual design.
 
@Ell Not XML.
 
Ell
then what is there?
 
2:39 PM
@CatPlusPlus if you think it's easy you probably end up with something like Mfc
 
Ell
besides in code
 
Besides, basic UI design is common sense, really.
 
Look at how enormous WPF is
 
@CatPlusPlus That's generally why we split them into "UI" and "UX".
 
"commonsensereally" is not valid in this context
 
2:39 PM
yeah using wpf may not require a (very skilled) programmer
making something like wpf work is different
 
I wrote UIs, k.
 
Everything requires a good programmer. The alternative is getting a shoddy job.
 
Especially eating.
 
That all programmers are artistically incapable is an ugly generalization and I resent it.
 
I didn't say that
 
2:40 PM
Well, it's true.
Nah, kidding.
 
I said that "UI is not a programmers job"
Can you do plumbery? If yes, good for you
 
We're all artists anyway.
 
But you're not a plumber
 
Ell
seriously - what? instead of xml?
 
Visual design of the UI is not a programmer's job.
 
2:41 PM
Not only design
Also interactions
 
user784668
@Cicada What if you're wrong, and everybody in the lounge is in fact a plumber except you?
 
It's much more than just visual
 
I'm not a plumber.
 
@Fanael That actually seems possible
 
Who do you think manages the interaction mathematics?
 
2:41 PM
@Fanael It's a-me, Mario.
 
My grandma?
 
I can't do plumbing.
 
I don't know, does she?
 
@CatPlusPlus I don't know, I've found WPF fairly easy and convenient to write in XML
 
Anyways thinking about it you need:
- Proper fonts and proper font rendering within OpenGL
- Widgets and UIs
- Mouse and keyboard input handling
- and kind of a signals and slot mechanism (or callbacks) to connect everything
- and then make sure that the whole ui can be set up declaratively
 
2:42 PM
XML sucks.
 
what else am I missing?
 
Always.
 
XML is too verbose
 
ah a proper serialization mechanism
 
Yes, please, no XML.
 
2:42 PM
Yes, you totally need widgets and UIs to make an UI.
 
there is gzip
 
What.
 
@CatPlusPlus You'd rather have the garbage you have to write to make say Swing work?
 
anyways you need a declarative lang for uis
 
2:42 PM
What.
 
user784668
@Collin "easy", "convenient" and "XML" in one sentence? WTF?
 
Declarative API, maybe.
 
Not necessarily, either.
 
@Fanael Compared to writing C# code to create it? Yeah
 
Ell
2:43 PM
Yaml!
 
nah xml is fine
 
There are rather complex UIs that don't use declarative/retained style.
 
sure it's verbose and not perfect, but it can be compressed
 
XML is never "fine".
 
What.
 
Ell
2:43 PM
I tried designing a yaml ui layout, but it wasn't anymore productive than xml
 
user784668
Your JSONs and YAMLs suck. Use Lisp.
 
Why don't you just HTML5
 
@CatPlusPlus like what?
 
You can write gzipped code directly?
2
MASTER TEACH ME YOUR WAYS.
3
 
@CatPlusPlus Of course there are, but it would take a week to figure out what was going on
 
2:43 PM
lol
 
Dear lord.
 
@Collin Not really, no.
 
What.
 
@Nils "Verbosity" has nothing to do with size on disk.
 
@CatPlusPlus I guess I've never seen good UI code
 
2:44 PM
There's no such thing as good UI code. But there are bearable ones.
 
There's no such thing as good code. There's only what looks good now and what you'll hate 6 months from now.
 
(Until I make my own perfect library, of course.)
 
Just for context, the cat is highly traumatized.
@DomagojPandža There's also what looks good now and is really bad right now, actually.
 
True, true.
 
well anyways I'm off cu
 
2:45 PM
@CatPlusPlus Which will be imperfect six months later.
 
user784668
@EtiennedeMartel tomorrow*
 
Or almost perfect.
 
No, it'll be always perfect.
ALWAYS.
 
PERFEKŠN.
 
No it won't, you're a cat.
 
2:46 PM
Does @DomagojPandža ever sleep?
 
No. He's a piece of paper.
 
No, he listens.
 
Paper never sleeps.
 
@CatPlusPlus You too, btw.
 
2:47 PM
I have to stalk my code so it doesn't turn ugly.
 
have anyone used dev c++? for c++
 
Ell
nope
 
Don't.
 
Yes
Don't use it
 
Ell
isnt it massively outdated?
 
2:49 PM
Massively is a weak word
 
user784668
@Ell No. It's being actively developed again.
 
lol
 
There's a recent version, I think.
 
It remembers how the dinosaurs looked like.
 
@Cicada then which one?
 
2:49 PM
Go for Visual Studio or Qt Creator
Both are decent C++ IDEs
 
Yes, there is. But it's still Dev and it still sucks, so.
 
@Cicada +2 for both!
 
user784668
@Cicada vim
 
Go for vim. Screw IDEs.
 
I said decent
 
2:50 PM
How is Code::Blocks? Last time I used it, I felt like I had plunged my head in a recently used toilet.
 
Decent IDE is an oxymoron.
 
Code::Blocks is a piece of shit.
 
Vim is for snobby linux power users.
 
I don't use Linux.
 
vim is for cats and robots.
 
2:50 PM
Vim is for noobs.
 
Are you a cat or a robot?
 
Emacs > Vim.
 
"Dev C++" Developer C++. Lumberjack's axe. No shit, Sherlock.
 
Ninja pirate zombie robot cat.
 
VACUUM CLEANER.
 
2:51 PM
@RadekdaknokSlupik You mad.
 
user784668
@EtiennedeMartel A robot cat?
 
@CatPlusPlus Nope. I'm right.
 
he jelly.
 
No, you're not.
 
I always thought the Cat used Linux, guess I was wrong
 
user784668
2:51 PM
-emacs > -vim
 
Here, I'll demonstrate why:
 
Liwhat?
 
Pfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff‌​fffffffffffffffffffffffft.
 
Honestly NetBeans isn't horrible for free windows available IDEs, a little slow though
 
@Cicada in neat beans i also see option for c++ .is it ggod?
 
2:52 PM
Typical Vim user. Says nonsense.
 
neat beans
 
user784668
@Collin It's Java, after all.
 
NetBeans is awesome, if you are required to use C++03. C++11 support is worse than shit.
 
At least I can write text without breaking my fingers on shortcuts.
 
Oh well i'm not a huge fan of Neat Beans
 
2:52 PM
NetBeans is mediocre at best.
 
Vim. Because Notepad is too mainstream.
 
@RadekdaknokSlupik Wouldn't that depend on the compiler? Or are you talking syntax highlighting?
 
@CatPlusPlus You ain't required to use any shortcuts.
 
Qt Creator or VS.
 
@Collin I'm talking about integration.
 
2:53 PM
How do you anything in Emacs without shortcuts?
 
@Cicada NetBeans is made of shit.
 
Syntax highlighting and the like.
 
Don't tell me you use mouse to click through those silly GUI menus.
 
I hate beans, both digital and IRL.
 
lol @DomagojPandža. I agree.
 
2:54 PM
HateBeans is a good name for a project.
 
lol emacs GUI
It's a joke.
 
Ell
do you think it is premature optimisation using std::vector<> with a length of width * height over std::vector<std::vector<>> ?
 
It might be good for locality.
 
user784668
Everything is a premature optimization.
 
2:55 PM
Also, easier to ensure sizes fit.
Obviously, you should use Eigen's Array, or Boost.MultiArray or whatnot.
 
Shit, I'm so tempted to take on writing an opensource IDE as a pet project.
 
@Ell I'd say it isn't if you're working with pixels in a 2d image, but there are libraries that do this for you.
 
You're crazy.
 
It'll suck.
 
Ell
Eigen's array? Boost.Multi_Array is fixed size I thought :s
 
2:55 PM
I have so many ideas.
 
@RadekdaknokSlupik So, no shortctus, no GUI. You use emacs as a glorified typewriter?
 
StringTemplate y u no find file.
@RMartinhoFernandes I don't use emacs.
 
Multiarrays are always fixed size.
Well, unless you're crazy.
You can resize it at runtime.
 
Crazy is good. Although my schedule is a bit tight lately. Must contemplate further. If it'll suck like our local vacuum cleaner robot, I won't engage it.
 
Ell
you can resize it at runtime?
 
2:56 PM
Yes.
 
I can resize anything at runtime.
 
It's not compile-time sized at all.
 
Only the number of dimensions is fixed.
 
Ell
Right okay. I'm reading the docs now
 
@RadekdaknokSlupik Yeah, we heard from your girlfriend. :Đ
 
2:57 PM
lol
 
user784668
lol
 
Also, dammit, I finally want to make a game.
I'm still stuck at stupid OpenGL.
 
2 mins ago, by Radek 'daknok' Slupik
It'll suck.
 
Ell
dont use opengl?
 
What's bothering you with OGL?
 
2:58 PM
Stuff.
 
Crossplatformness.
Or something.
 
Carrots.
 
That might be better.
 
> "java.lang.IllegalArgumentException: Can't find template reports/index.st"
 
Also text rendering.
 
2:58 PM
Why the fuck is that an "IllegalArgumentException"?
 
@CatPlusPlus Springbok needs your help.
 
I'd recommend DirectX, but I am implementing a crossplatform DX/OGL renderer, so I can't really advocate any particular API.
 
@RadekdaknokSlupik ArgumentException in .NET
 
user784668
@CatPlusPlus Create your own 3D API and make the video card manufacturers implement it in their drivers.
 
Prefer DX on Windouz.
 
2:59 PM
I want it to be cross-platform and I'm too lazy to implement two code paths for now.
 
@RadekdaknokSlupik You passed bad data.
 
Ell
@CatPlusPlus why don't you use a higher level library?
 
@EtiennedeMartel Yeah, but why does it get thrown if it cannot find a file?
(Which clearly is there, but that aside.)
 
Yargh.
 
Because the guy who wrote that code decided against using a more precise exception type.
 

« first day (598 days earlier)      last day (4352 days later) »