« first day (1431 days earlier)      last day (3503 days later) » 

12:00 AM
And why I need to provide a size? Can't I just initialize it?
 
@Nooble Somewhere in the C++ standard.
 
@Nooble Standard says you need to provide a size. So you do.
 
@Nooble I'm not sure of the reason why, exactly.
 
Because the size for the type must be determined at compile time
otherwise use something with heap allocation like std::vector
 
it technically is
 
12:02 AM
And now... cannot specify explicit initializer for arrays. I'm having a bad day.
 
Not if you have one that's initalised with 4 values, and another with 6 etc
 
@Nooble Compile with C++11.
@OMGtechy you can't reassign arrays
 
Oh wait, this isn't in a constructor?
 
No.
 
Ahh
 
12:04 AM
It's a private member.
What does this error even mean?
I swear I was able to do this before.
 
What're you trying to do now?
 
Err...
Let my c and p
 
user1646075
@Nooble but you're on the right track
 
float Vertices[9] = { 0.0f, 0.5f, 1.0f, 0.5f, -0.5f, 1.0f, -0.5f, -0.5f, 1.0f };
 
non static member initializers is a C++11 feature
 
12:05 AM
How do I do this normally.
Without C++ 11
I just want to make an array in a class :C
 
float foo[9];
then in the ctor assign the values
 
You should use C++11 m8
 
Use an initializer list in your ctor.
 
I mean sure, I'll set VS2013 to use C++ 11 m9
 
user1646075
or use a vector for great success
 
12:06 AM
^
 
you can't use initialization list to initialise an array.
you're SOL
 
Yet this works perfectly fine out of a class.
 
main.cpp: In constructor 'f::f()':
main.cpp:3:12: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
     f(): x({1, 2, 3, 4, 5, 6, 7, 8, 9}) {}
            ^
main.cpp:3:39: warning: list-initializer for non-class type must not be parenthesized
     f(): x({1, 2, 3, 4, 5, 6, 7, 8, 9}) {}
                                       ^
time to eat
 
user1646075
@Nooble outside of a class, you are allocating storage. Inside a class, you're declaring an intention to allocate storage. This ain't Python etc
 
I just started to learn C++ 3 months ago
I'm getting Mindfucked by the second.
But it's good, I'm learning.
Hue
 
user1646075
12:11 AM
@Nooble bunker down for a lot more. Bring snacks.
 
Nothing beats snacks.
 
use C++11 if you're new
C++03 is old
 
VS2013 is using C++11
At least I think by default.
Let me go check
 
not really because it doesnt implement all of it
 
MSVC is a terrible C++11 compiler
 
12:13 AM
and parts of it, are broken
 
Yep...
 
it doesn't support Non static member initialiser
iirc
 
What compilers do you people use?
GCC?
 
yep
 
VS2013 :P sometimes clang
 
user1646075
12:13 AM
hand-assembly
 
Gonna go get snacks.
 
user1646075
heh
 
clang is like heaven for C++, but when I'm on Windows I must do without such wonders
 
user1646075
bring enough for everyone.
 
Sure will.
What do you mean by declaring an intention to allocate storage?
 
12:16 AM
declaring a class doesnt take up storage, declaring a variable does. i guess its what he was getting at
 
user1646075
inside a class, float thingy[N]; means that when a thingy is allocated, it will have space for N floats.
 
user1646075
i'm trying to speak intuitively - tends to help with acolytes.
 
And I have to allocate things in the constructor?
 
user1646075
the constructor is where the work normally takes place to build the bidniz
 
user1646075
i think i used the word acolyte wrongly.
 
12:19 AM
I think the simpler way to do this is to simply assign each value by index until you understand why the initialiser list is making it cry like a bitch
 
user1646075
vector. vector. vector.
 
Or that, yes.
 
user1646075
dare we suggest memcpy
 
Or std::array!
Take that shameless self promotion
clearly this needs to be done in Malbolge
 
12:21 AM
that's awesome haha
Gotta love them move semantics
Plus, in c++14, we'll have make_unique
 
its quite a silly oversight that they gave us make_shared in c++11 but not make_unique
 
yeah haha, but it's hardly the end of the world. Is silly though
I'm mostly looking forward to homogeneous type lookup, generic lambdas and relaxed constexpr
 
make_shared does a lot more
this blogpost could be shortened to auto f = [](int b) { return computeSomething(5, b); };
 
rekt
 
Yeah, but the post was about std::function and std::bind really
thanks though.
 
12:28 AM
also the name for this is called partial function application
 
I think my next post is going to be about either lamdas or variadic templates
 
if you're curious or w/e
 
Is it? Awesome, I'll change that
I am :)
 
I'm back from eating snacks.
Now, where was I?
 
:P
thanks for the info though, it's nice to know the proper name for it
 
12:37 AM
Oh right, stupid compiler won't use C++11 Features.
 
np
 
I wonder what will happen in 2098 if C++ is still going
will it be C++98? xD
 
C++Overflow
 
Lel
 
C++Over9000
 
12:39 AM
C++2098?
Hue...
 
That's too simple, we can't have that.
 
Good point.
C++45.8039299624^2
 
C++98x.
 
It must be witty, overly complex and off-putting to outsiders. Otherwise it's not C++ and I don't want to know about it.
 
C++ .NET
That's off-putting.
 
user1646075
12:40 AM
(by (then (it 's syntax) (will have) changed) (dramatically)
 
user1646075
) damn
 
How about C++(60.37273546310986 * log(42))
because 42
 
user1646075
y'know, 42 would be a perfect name for a programming language
 
user1646075
must trademark it
 
log(42) is worryingly close to the golden ratio
Hitchhiker++
 
user1646075
12:43 AM
i know - C++ Millenium Edition
 
C++ Millenium Edition++48
 
C++MRSA
 
C++: Advanced Warfare
 
C++: Call of Medal Duty Zombies Rising 7
 
user1646075
or maybe it's evolved so much it will have to be called C+=2
 
12:44 AM
or ++C
It's just slightly ahead, all the time
Or D, oh wait...
 
user1646075
@OMGtechy no, that's when they finally get it right.
 
So, never?
 
user1646075
C++ Never? C++ Neverland?
 
user1646075
C++, Like, Wheneva
 
Java?
 
12:46 AM
NO
 
user1646075
ewwwww
 
HUE
Java++
 
Why did the developer use Java? Because he couldn't C#.
 
OHOHOHHOHOHO
 
user1646075
i'm going to assume that's a pun
 
12:46 AM
#SIKBURN
 
#YOLO++
 
C/0
Alright, I'm done. How the hell am I supposed to put an array inside a damn class. C++TooHard++--++2048
 
How about adding a + for each standard
C++++++++++++
 
^
 
@Nooble want a hand?
 
12:48 AM
YES
 
Alrighty then, one sec
 
user1646075
 
user1646075
well, someone had to.
 
Thanks.
 
12:52 AM
If you don't name your variable foobartimusrex, the compiler refuses to do anything useful. It has feelings yaknow.
 
So we can't use initalizer lists?
 
initialization list is different from initializer list
 
*Initialization List
 
5
Q: How to initialize an array in C++ objects

Quade2002After reading How to initialize an array in C, in particular: Don't overlook the obvious solution, though: int myArray[10] = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }; I tried something like this: #include <iostream> class Something { private: int myArray[10]; public: Something() { myA...

Short answer is, unless it's static, just use the index syntax.
 
Gotcha
 
12:56 AM
You could use an std::vector<T> too.
Which, if you plan on adding move semantics, might be advantageous.
actually, that last statement might be bollucks (the move semantics bit)
Nope, I un-take that back
 

« first day (1431 days earlier)      last day (3503 days later) »