« first day (40 days earlier)      last day (4911 days later) » 

4:41 AM
Lol. Now this room is the`Home of Undefined Behavior`. :D
 
I wonder if there's any country where one can get arrested for Undefined Behavior?
 
 
3 hours later…
7:55 AM
well I guess it depends how Undefined Behaviour is defined, if that even makes sense. :)
 
8:36 AM
hi
does anybody know how to construct AVL-tree to store vertexes and then search vertex using tolerance? for example vertex1(x1,y1,z1) == vertex2(x2,y2,z2) if abs(x2-x1)<=e && abs(y2-y1)<=e && abs(z2-z1)<=e?
 
8:48 AM
@JevgenijNekrasov what about using one of the STL Containers? map for example is implemented as a Red-Black Tree
which is fairly similar to a AVL Tree
 
8:58 AM
@Tony I get vertexes from STL file and I have only three coordinates (x,y,z) if I try to use Map Container so how should i construct map key?
 
you could use a struct to store your coordinates, then create a key from a combination of your values... depends on how you wish to identify your coordinates I guess
 
0
Q: Put option to view readme file at the end of Install Sheild Setup

jaminatorHi, I am making an installer in install shield 8 and trying to put an option as in a check in the setupcomplete dialog, i am using the below link as help: http://kb.flexerasoftware.com/selfservice/viewContent.do?externalID=Q106070 As also stated in this link: "An InstallScript custom action may...

 
@jaminator
this is a C++ chat
 
hm...i dont really understand lets assume I have first vertex1, which is represented by three doubles x1,y1,z1. Ok, I've constructed my key from this combination. But then if I try to add vertex2, which is equaled to the vertex1 I will still have different key for this vertex2 because of the tolerance, but i don't need to add this vertex2 because it's already presented in my map.
 
9:20 AM
so you want double keys or not?
 
@JevgenijNekrasov, the relation between your vertices is not transitive, i.e. while x can be close to y and y close to z, x needn't be close to z. Therefore, you can't construct a strict weak ordering, which is a requirement for ordered STL containers.
What you want to do can be done with spatial index structures, i.e. Kd-trees, R-trees, M-trees and such
 
@avakar seems to be more experienced with this, so his advice is prob worth more
 
@avakar @Tony thanks! I will try to experiment with spatial structures
 
:)
 
By the way, mesh optimization is a complex subject. Throwing away vertices that are close will certainly decrease their number, but may not produce an aesthetically pleasing result.
You may want to read up on the subject first: docs.google.com/…
 
9:37 AM
@avakar thanks! Actually I am trying to construct topology from triangle soup when trying to parse STL file and first of all I need to merge vertexes to remove redundancy, which is presented in STL file format by default and to reduce memory usage and sure to simplifier all subsequent operations
 
@JevgenijNekrasov, ah, all right then, go with spatial indexes :)
So the vertex is present once for each face adjacent to it?
 
Triangle Soup.... sounds like you could put it on your plate to eat
 
9:55 AM
@avakar each facet is defined by three vertices, whose coordinates are explicitly specified. so if you have two adjacent facets they will share to vertices with some small tolerance, initially they are different (they have different coordinates). so you could replace them and share one instance to reference from adjacent facets. this will remove significant redundancy, which is presented in the model. Actually each vertex in STL file is unique, it's just a mesh of vertices.
 
10:09 AM
1
Q: Making an undefined class as friend, and defining it later.

user420536Making an unknown friend template<typename T> class List { protected: class a { int x; int y; private: friend class b; // <------------ Why this is not an error? }; template <typename U > class b { //If that is not a error this should b...

this is a g++ bug or what?
 
@surajkumar it has nothing to do with making an undefined class a friend
 
Thank you. But the interesting thing in his post is that on comeau it is a redeclaration error. As far as I know redeclaration is not an error, shouldn't it have said conflicting declaration of different type?
 
@surajkumar and yes it's a bug; see @prasoon answer
@surajkumar compiler diagnostics are at best distantly associated with erorz they diagnose
:-)
 
@AlfPSteinbach the second half of my comment was user420536's comment under prasoon's post. i am not sure.
2
A: Making an undefined class as friend, and defining it later.

Prasoon SauravThe code is ill-formed and Comeau rejects it giving the following error error: invalid redeclaration of type name "b" (declared at line 11) I think this is a bug in g++ and MSVC++. Intel C++ rejects it too. You can fix the code by defining class B above A. template <typename U > c...

 
I have the following code: codepad.org/iTsD6Xq3 and it produces 46 linker errors of type LNK2005, quite a few of them are from MSVCRTD.lib, this has me searching for an answer for a few hours now, can someone please help?
 
10:23 AM
@Tony Although in the code as presented you've forgotten to implement one function, most likely the main problem is in your linker invocation. Or if you're using Visual Studio, your setup of the Visual Studio project. Make sure that everything's present and that you have no conflicting runtime library specifications.
 
@AlfPSteinbach why is the code ill-formed as written in one of the answers?
 
@AlfPSteinbach could this be the issue: LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
 
@Tony yes, that's conflicting runtime lib specs
 
so I just have to add that switch to my linker args?
 
@Tony with msvc runtime lib is specified at compilation. it emits linker directive. silly but there you have it.
 
10:27 AM
??????
 
@AlfPSteinbach I'm confused, so what do I have to do?
 
@surajkumar it first declares (via the friend declaration) a class with name Something. Then in the same (class) scope it defines a class template named Something. Can't do that.
@Tony Check the project settings for each file. The relevant item is runtime lib. General good choice is multithreaded DLL.
@tony sorry, i forgot, you're using boost but i don't recall what parts of boost, but if it's something that's separately compiled (not just header) than probably that's the culprit
 
I just fixed it, its what you said about the runtime lib
thx a lot :) +10 if this was an SO Question :)
 
he he. even a blind man can sometimes hit target.
@tina is it important?
i'm just visiting
ok
 
 
2 hours later…
12:27 PM
can a variable in a union not a have any user-defined or non-default ctors?
 
12:48 PM
0
Q: union in C++ and non-default constructible objects

TonyI have a situation in my program where I need to do some conversion from strings to various types and obviously the outcome can only be ever one type. So I opted to create a union and called it variant, as such: union variant { int v_int; float v_float; double v_double; long v_l...

 
 
2 hours later…
hey
2:22 PM
h
hey
 
2:44 PM
hey @hey
what kind of a nick is that??
 
 
1 hour later…
4:12 PM
hello there.. what do you guy think about DeadMG removing C++ tag here:
5
Q: Declaring variables inside C switch/case

zsergeWell, this is not actually a question.. I have just occasionally found out that there's an interesting way to declare local variables inside a switch/case block. Instead of using braces inside every case block, you can write: switch (action) { int res; int value; case ACTION_OPEN: res = o...

 
@JohannesSchaublitb The C++ tag that was there (?) would be very appropriate because, if I recall correctly, C and C++ differ in the rules. In C++ you can't jump over an initialization. Of course someone would have to bother to write a proper answer...
 
Is there a way to check for the inclusion of header using pre-processor directives, so if that header has already been included, indirectly perhaps, it won't include it again?
 
4:28 PM
@Tony The three main ways are (1) ordinary include guards, standard C++; (2) Lakos style external include guards, also standard C++, only makes sense for larger project and possibly not even then; (3) #pragma once, not C++ standard but de facto standard, supported by most compilers.
 
4:42 PM
I've got include guards in all my headers
but I have one header that I accidentally included twice, once directly and once indirectly, both have include guards; my compiler still complains about double definition of a global function
in the doubly included header
so would #pragma once solve that?
 
it could, but better check the speling of the include guard symbol ;-)
hey, wait, compiler or linker?
@tony the exact diagnostic would help to, so to speak, diagnose the problem, but "double definition" sounds like linking error. if you define a function outside a class, in a header file, you need to make it inline. a function template is not a function definition in this sense, but a full specialization of a function template is (it's a bit subtle).
 
5:03 PM
@Alf i remember we talked about that in a comment on SO about reading UB with unsigned char
 
@JohannesSchaublitb not sure i remember, but i'm sure you're right, link?
 
@Alf see discussion on this answer: stackoverflow.com/questions/3892098/…
dunno what "ENIAC-compatibility" is tho -.-
 
@Johannes: thanks! updated!
 
@Johannes: uh, I pasted wrong link at first, to YouTube music video by Delerium. Heh. :-)
 
5:15 PM
haha
 

« first day (40 days earlier)      last day (4911 days later) »