« first day (462 days earlier)      last day (2397 days later) » 

1:24 AM
Hello, can someone help me interpret what this line means MovementParameters() : x(0), y(0), vx(0.5), vy(0.2) // initialization list in pastebin.com/yf5RKiEA example code. I'm not all that familiar with c++ and that's the first time I see something like that.
 
1 message moved from Lounge<C++>
It's basically similar to a constructor like MovementParameters() { x = 0; y = 0; vx=0.5; }. The big difference comes with things like references--they have to be initialized, not assigned, and an initialization list supports actual initialization (where doing it in the body as I've shown here obviously uses assignment instead).
 
Let me try to rephrase that to sound more familiar to lingo I'm familiar with: if I wanted to have a class that's a composition (contains an object as a member) I would not be able to do it within a constructor if I wrote it up with {} and the user of that class would have to initialize it specifically and then call the constructor with the reference to that initialized object?
 
2:17 AM
@ljetibo Yes, if you want to invoke a constructor of a parent or contained object, you do it via the initializer list.
 
Thank you!
 
 
2 hours later…
4:10 AM
How do I do something like for(j=1,2,3,4,5,11,12,18,19;;) ?
in Bash, it is simple like for i in '1' '2' '18' etc.
@JerryCoffin Hi.
 
unclear ...
for (j=1; j<=12; j++) & for (j=18; j<=19; j++)
not sure what you are trying to do ...
 
do you know bash syntax like:
for i in '1' '2' '44' '12'; do echo $i; done
?
here you can choose how the value of i is assigned.
I want alternative in C
@Telkitty I want only 1 to 5, 11,12,18 and 19.
looking for syntax - how to define.
 
use for loop or if or switch
 
4:25 AM
Hmm, switch would work.
Thanks.
But switch can only check can't define 4,5,11,12,18,19.
I think using multiple for is only work around
 
4:59 AM
for (auto what_ever : {1,2,3,4,5})
 
 
4 hours later…
8:51 AM
sup?
http://en.cppreference.com/w/cpp/utility/functional/function/function
>5) Initializes the target with a copy of f. If f is a null pointer to function or null pointer to member, *this will be empty after the call.
So it will fail silently until I use `this` or data member?
 
@EuriPinhollow *this in this context is referring to the instance of std::function being constructed
An empty std::function will evaluate to false and its operator() throws
 
9:07 AM
Fuck I cannot read.
 
9:43 AM
>Partial specializations of member template may appear both at class scope and at enclosing namespace scope, but explicit specializations may only appear at enclosing namespace scope.

What's rationale for prohibiting explicit specializations in class scope?
 
9:55 AM
anyone know what the output tells you about the architecture of the machine this program is intended for ? pastebin.com/iJes8JRs
 
nwp
@EuriPinhollow Maybe that stuff in class scope is supposed to be private and having different specializations depending on if you are in a member function or not seems complicated and surprising and ignoring private looks like a bug.
 
Maybe it's to do with overloads, but then partial specializations being allowed doesn't make that much sense
 
@M.Jones it is said there iterally.
It is prohibited for both member class and member function templates.
 
amd64. ?
 
10:07 AM
where can i find information on the memory access rights for the .text, .rodata, .data, and .bss sections?
 
I do not know what's that but it's relevant to ELF format and Linux kernel internals.
 
or the PE format and windows internals
 
Actually the quoted piece is about nested class templates, not function templates.
 
10:27 AM
is it a good practise to bundle all structs in one header ?
i have something like this: struct LMStateTracker
{
LMLightState lightState; ///< Light parameter
LMCameraState cameraState; ///< Camera parameter
QMatrix4x4 transformationState; ///< Transformation
};
lightState and cameraState are also structs which i have for now in separate header
 
nwp
@FerencRozsa No. Ideally you can separate out high level concepts like "Shaders", "Lighting", "Models" and so on and can keep them somewhat separate.
At least some of them have to interact with each other, but having small pieces with some glue logic tends to be easier to maintain than one monolithic monster.
 
In computing, a data segment (often denoted .data) is a portion of an object file or the corresponding virtual address space of a program that contains initialized static variables, that is, global variables and static local variables. The size of this segment is determined by the size of the values in the program's source code, and does not change at run time. The data segment is read-write, since the values of variables can be altered at run time. This is in contrast to the read-only data segment (rodata segment or .rodata), which contains static constants rather than variables; it also contrasts...
 
o.k. nwp if i understand you right. let it separate header to keep a logical order and a better mantaining.
 
 
1 hour later…
Ron
11:40 AM
Can someone please take a look at this one? Seems to be some compiler version issue.
 
11:52 AM
this is basically a "which compiler is right" question, and one I'm not qualified for. I believe this shouldn't compile because the addition of using A::func unhides the function and makes it participate in the overload resolution, and having these two as free functions in the global namespace fails
 
12:14 PM
of course this is assuming that a lot of things, including whether overload resolution is even relevant here
 
@milleniumbug Why did you mention global namespace?
 
12:32 PM
@EuriPinhollow if you put the functions in the same namespace, they'll participate in overload resolution. If you use using A::func;, they both participate in overload resolution if you call b.func()
Now, here OR probably doesn't even matter, hence the disclaimer that basically says that I have no clue
 
Ron
12:44 PM
@milleniumbug Great insight. Thanks.
 
 
4 hours later…
4:23 PM
i have a question, if i have 2 threads both accessing the same memory, one thread reads from a file in 512 blocks and saves the blocks in a vector, the other thread copies whatever is inside the vector and puts it in another file, how do i synchronize the threads? is there a simples way do to it? or do i have to do something nasty like creating a variable and changing its value constantly?
 
nwp
You either find some thread-safe queue or you emulate one using a std::mutex that you have to acquire while reading and writing.
The first is probably what you want.
 
with the queue you push the 512 byte block (in its entirety) in the first thread and then you pop the queue in the second thread
 
hmmm, is the situation the same if my vector stores 2 512 blocks, when a new block comes it pushes the previous forward, the writing thread only writes the last block and the reading one only writhe to the first block, i would still need the queue no?
maybe it wouldnt be safe
nah, what i sed didnt make much sence, ill try what you guys sed
thanks!
 
nwp
May steal this one.
 
You can use a circular buffer (sometimes called a fixed length queue) if you want to avoid the overhead of allocation
 
5:00 PM
chat bug report test
 
5:24 PM
bug reported
0
Q: Can't find the C room in the "message move search window"

milleniumbugSeveral days ago I tried moving a question about C from a C# room to the C room, but this failed for two reasons: First, in order for autocomplete to happen, you need to type in several characters, even waiting long enough won't trigger it. I had to work around this by adding spaces. The room d...

 
nwp
Look ma, I'm on meta!
Not sure if I should be embarrassed of having that starboard captured on there.
 
5:40 PM
@nwp yeah, I thought about that too, but I had spent too much time editing that gif so there :D
 
 
5 hours later…
10:18 PM
@Ron And it turned out to be wrong, apparently Clang is correct here and hiding should happen even with using
5
A: Hiding of member function templates - Which compiler is correct?

StoryTellerUnless I'm mistaken (spoiler: I was), GCC is kinda in the right. This simply isn't specified to be resolved somehow. For one, there's [temp.fct.spec]/3: Trailing template arguments that can be deduced or obtained from default template-arguments may be omitted from the list of explicit te...

that said, even if gcc was right, the OR remark still wouldn't be relevant
 

« first day (462 days earlier)      last day (2397 days later) »