« first day (670 days earlier)      last day (2189 days later) » 

nwp
What do you want to optimize?
You probably don't want to make a copy of the boundedNodes.
 
@nwp i do that ?
 
nwp
for (auto bnode : boundedNodes) makes a copy of every node.
I guess you don't make a copy of everything because you stop the loop early when you found a collision.
 
@nwp ah o.k., no boundedNodes holds only pointers so it doesnt matter.
optimization in the case of reducing lines\code.
 
nwp
11:30 AM
I guess you could do
    if (type == VOLUMETYPE_AABB && bounding_volume.aabb.isCollided(point) || type == VOLUMETYPE_OBB && bounding_volume.obb.isCollided(point) || type == VOLUMETYPE_SPHERE && bounding_volume.sphere.isCollided(point)) {
        return true;
    }
But that's probably not very readable.
 
11:42 AM
@nwp no problem...thx anyway
 
12:08 PM
i need a simple indicator that the user choosed to do boolean operation from the menu...dont know if that is a bit to overdosed:
enum BooleanOperation
{
BOOLEANOPERATION_ON,
BOOLEANOPERATION_OFF
},
maybe a simple true/false boolean do it also
 
hlt
12:50 PM
Just use a simple bool flag (maybe call it something like operationEnabled). Boolean enums always remind me of thedailywtf.com/articles/What_Is_Truth_0x3f_
 
1:02 PM
@hlt and yet they are always a better choice than boolean traps
 
1:22 PM
:-) thx for the answer...the flag has to be global accessable.
 
1:48 PM
Hi folks 0/ - Can anyone give me a vague (even just conceptual) estimate of the relative performance benefit of using POD types over non-POD types (with respect to trivial types and/or standard layout types), under the assumption that a large number of a given object will stored in large quantities?
 
user2411267
Hey guys can I get some opinions on this? I need to test my wcf, the problem is the actual data is huge 21k tests are needed
I've tried different things but I feel like I'm heading the wrong way, looking for a way to build a unit tests around the data where each data entry is considered a test on its own and failure in one test won't stop the execution of the rest
 
Also, I know that rust can optimise out unnecessary copies in method calls (and thereby reduce the need for making params references instead of straight up values), when the source of the param is garaunteed not to change during method execution. Will C++ compilers generally perform similar optimisations for POD types?
 
2:07 PM
1 message moved from Lounge<C++>
@Cosmo measure it. I can can give you a vague estimate: 42
@Cosmo Yes. See godbolt.org
@Ali.B Can you script it taking inputs from a directory and comparing to stored expected outputs from another?
 
user2411267
@sehe yes already did the reading input / calculating, the problem is declaring individual tests for each input. so that if one fails it doesn't affect the execution of others.
 
@sehe it's just a hypothetical question at this stage. I'm not in a position where I actually need to be that careful with performance right now.
But thank you.
 
 
1 hour later…
3:21 PM
Hi Guys, Did anyone familiar with c++ stomp? what is this different to AMQP? Can I use stomp to any platform of mq server?
 
1 message moved from Lounge<C++>
 
4:01 PM
@Ali.B Either use separate processes, or use a test framework that affords this. I have experience with Boost Test which has no problem with tests that segfault, and just carries on with the rest. I suspect Google Test to have a similar facility.
 
4:15 PM
Can anyone tell me if this (>=10k link) is valid C++?
 
Why does std::gmtime accept a const pointer to time_t?
std::tm* gmtime( const std::time_t* time )
What's the issue with it being std::tm* gmtime( std::time_t time )?
 
~~legacy~~
 
(for non-10k, the code there is
template<std::size_t First, std::size_t... Other, class... SizeTs>
static constexpr size_type linearise(std::size_t index, SizeTs... indices)
{
    return multidimensional_array::multiply<Other...>()*index + multidimensional_array::linearise<Other...>(indices...);
}
I want to ask if multiple template parameter pack is valid. I also read this.
 
4:31 PM
Is there a way to get C++ standard string?
something which tells which version of C++ is being used
is there a compiler independent symbol which provides compiler information (possibly with the standard)?
 
Like, after the program has compiled?
 
yes
 
I think it compiles to like, assembly or such, doesn't it?
Or, to CLR if visual c++ maybe
 
The purpose is to print this information when the program starts. The program is actually a dynamically linked library which provides some functions. By printing the version and what not, the end user can know how the function will behave (because the function calls a standard library function)
 
If you want to add the functionality /to/ your program, then there are some flags stored in defines or such yes
 
4:35 PM
?
 
e.g. uh
 
I just want to print information about the compiler used, standard library used, etc.
 
there may be more compiler-dependant macro flags, but those are the gnu defined ones SFAIK
within that. __cplusplus indicates the c++ standard version used
does that link help?
 
yes
 
great
 
4:39 PM
the only thing left is the compiler and its version
as of now, I have a hardcoded thing which works for MSVC & G++ only
 
Yeah that's probably compiler specific
I'm off to bed though, good luck
 
4:56 PM
gmtime returns a std::tm*
where's that object?
static local?
Pointer to a static internal std::tm object on success, or null pointer otherwise.
 
IOW, garbage function
can't use it safely from different threads
 
I know that I can use:
virtual void functionName() = 0;
But can I do something like
virtual std::stack myStack = 0;
In an abstract class?
 
what would it do
 
I basically um want to require the derived class to have a certain variable?
 
so put it in the base class and make it protected then
all derived classes will be able to access it
 
5:05 PM
@user202729 Yes it is
 
Ah okay
 
19
Q: What are the gcc predefined macros for the compiler's version number?

WilliamKFI have run into a bug with gcc v3.4.4 and which to put an #ifdef in my code to work around the bug for only that version of the compiler. What are the GCC compiler preprocessor predefined macros to detect the version number of the compiler?

 
#include <cstdio>
#include <ctime>

int main()
{
    std::timespec ts;
    std::timespec_get(&ts, TIME_UTC);
    char buf[100];
    std::strftime(buf, sizeof buf, "%D %T", std::gmtime(&ts.tv_sec));
    std::printf("Current time: %s.%09ld UTC\n", buf, ts.tv_nsec);
}
I don't understand that example given at cppreference.com
std::gmtime(&ts.tv_sec)
std::time_t needn't necessarily store the number of seconds from epoch, right?
 
Hmm, I want to implement a stack based FSM like so: https://gamedevelopment.tutsplus.com/tutorials/finite-state-machines-theory-and-implementation--gamedev-11867 (Scroll down a bit..)

If I understood right... I would need my stack to accept a void function pointers? How do I pass that type to std::stack<T> ? (as in what would T be?)
 
6:09 PM
@Yashas Correct.
@Annabelle Do the functions take any parameters? If not, void (*T)();
 
No they do not take parameters
Okay so it'd be um
std::stack<void (*T)()> ?
Or did I understand it wrong
x.x
 
@JerryCoffin then why does the example use std::gmtime(&ts.tv_sec)? std::gmtime takes std::time_t as an argument and that example passes the number of seconds from some undefined epoch.
 
@Annabelle More like typedef void (*T)(); std::stack<T> foo; or if you don't want the typedef, std::stack<void(*)()>
 
Ah okay
Thank you
 
@Yashas At least at first glance, it looks like it's really a POSIX example.
 
6:20 PM
std::timespec uses tv_ prefix for its member variables. What does tv stand for?
 
@Yashas I think it probably came from the UNIX timeval, which has a tv_sec and tv_usec. They changed the structure name because they now to nanoseconds, but retained the (now misleading) tv_ prefix.
 
Or just "time value"
 
also, these prefixes are from the times when the C language didn't allow members of two different structs to have the same name
so don't pay too much attention to them
 
@Yashas Actually, rereading it, I don't think it does require any extra-standard definitions. They passTIME_UTC when they call timespec_get, and that does (at least sort of) define an epoch.
 
UTC is about string representation of time, isn't it? So it doesn't tell anything about the epoch, right?
 
6:35 PM
UTC is a timezone
 
@Yashas No. UTC is coordinated universal time. It's not about string representation. But, TIME_UTC defines a time base.
 
 
2 hours later…
8:59 PM
@JerryCoffin Am I approaching/understanding this the correct way?
 
 
2 hours later…
10:51 PM
Hmmm
main.cpp: In member function 'void (* Entity::popState())()':
main.cpp:30:26: error: void value not ignored as it ought to be
  return entityStates.pop();
What does this error mean?
 
nwp
@Annabelle Check what std::stack::pop returns.
 
Oh
It doesn't reurn anything
 
hence the error message
 
So I think I would uh
mean to do
get the top element
and then pop it?
the stack based fsm
Okay
I think I fixed it and it compiles
I guess I should test it now.
 
11:15 PM
If myClass is a class, what's the difference between defining obj as myClass obj(var1, var2) and defining it as myClass obj= myClass(var1, var2)?
 
11:37 PM
In the second case you're actually, potentially, copying the object
 
In what case would it copy the object?
 
11:49 PM
What am I doing wrong here?
 
Probably the const? I think the signature for main is "int main ( int argc, char **argv )"
I'm not 100% on that though, I am also a novice.
 
No that's not it.
It's something with the way my EntityStateManager is defined...
 
Ah, I'm not used to repl.it. I didn't realize there were multiple pages.
 

« first day (670 days earlier)      last day (2189 days later) »