« first day (9 days earlier)      last day (4931 days later) » 

6:44 AM
@JamesMcNellis I just saw your edit, haha.
 
7:00 AM
@GMan: I had no idea that it's possible to edit someone else's deleted content!
 
Heh, yup. I've never seen it used to hold a small exchange though.
 
I'd say that provides a good way to laugh at people who delete wrong answers, but I delete enough of my own answers that that is probably a bad idea
 
lol.
 
7:40 AM
anyone ever used xcerces-C++ on windows?
I have a problem with Xerces_autoconf_config.hpp not being found when compiling under VS2003
 
Does the file exist?
 
it does not, it says to run some config file, but its a linux/unix config file
so I don't know what to do, cause I'm running windows
 
yes
I didn't do the build; cause I just want to link directly in my project
 
7:55 AM
You mean the "build" will be alongside your other real project?
 
I mean, I just include the headers of the library in my project and then it gets built into the project, I don't create a .lib file from the library and use that
 
Right, including the .cpp too. Look for that file in projects\Win32\VC7.1\xerces-all\xerces-all.sln
er, not the .sln, but that directory. Or maybe even open the.sln and see if you see it in there.
Your best bet is to "fake" build it so you can at least see what you need to extract for yourself.
 
is that part of the standard .zip file you download on xerces?
 
i didn't download it, but it should be according to the build instructions
 
found it
so i'll just try to build that sln file
see what happens
maybe it creates the config file or something
 
8:04 AM
ya
 
8:28 AM
it fixed it
:) @Gman
 
8:47 AM
yay :)
 
9:09 AM
Any one here.
 
yes
 
what is the best way to create an array of structs, a pointer to the struct or an explicit array using []? the array size is undefined at compile time;
 
yes
A std::vector.
 
I have an object of structure, how can I called its contractor, through this object.
 
Code?
 
9:17 AM
code\/
 
Yeah, that's one hell of a struct :D
 
this struct does not have a constructor
oooor oy bari ustad
 
oO What's that ?
 
it is punjabi
 
Whoa, the room just filled up quite a bit.
 
9:20 AM
I want to call the constructor of structure from the object, how its possible.
 
GAM: with people wanting to see what's going on in C++ chat ;P
 
user400055
You cannot
 
I dont have pointer.
 
Maybe show us your code on codepad.org.
 
user400055
your constructor must look like this:
 
user400055
9:21 AM
myclass()
{
setup();
}
 
user400055
then you call setup - in effect calling the constructor
 
@ExtremeCoder, its not constructor.
 
user400055
then please explain further?
 
@Arman Does this clarify? codepad.org/9frXUKX7
 
I already thought that StackOverflow was a fantastic concept but this new editable chat is really great as well.
 
9:26 AM
struct abc{
abc()
{
//Some Fuctionality
}
};
void main()
{
abc obj;
//How can I recall the constructor just like
abc *obj2;
obj2 = new abc();
}
 
@ereOn Editable?
@Arman Your constructor is called in that code.
 
@GMan: well, in the sense that you can delete your posts.
 
Also, main returns an int, not avoid.
(And your example leaks, but I digress.)
a void*.
 
@Arman: The goal of a constructor is to construct an objet. Why would you reconstruct something that already exists ? Or am I missing something ?
 
I have created a struct called Attribute and added it to a vector: std::vector<struct Attribute> v_attributes;
now when I do push_back on this vector the compiler says it does not know the size of this struct... how can I resolve this?
 
9:29 AM
Do std::vector<Attribute>.
 
@Tony: The compiler probably doesn't know what your structure definition is.
 
In C++, you don't need to elaborate the names.
 
@Tony: Have you declared your structure in the same file ? (Or included the file that does ?)
 
yes inside the class where the vector is declare
struct NodeAttribute
{
std::string key;
std::string value;
} Attribute;
 
user400055
I have to say, this chat is amazingly good. Grats to the coders who implemented this,
 
lx
9:30 AM
ah... Attribute is an actual instance of that struct
 
Is there a typedef there? As in typedef struct NodeAttribute { ... } Attribute?
 
lx
std::vector<NodeAttribute>
 
@Gman: indeed you don't need to elaborate. But is doing so invalid then ? (In the case of a std::vector<struct Something> ?)
 
If not, do as @lx says. Attribute is an instance of the type NodeAttribute.
@ereOn: No, but in some corner cases it could hide the error.
 
Ok, thanks. ;)
 
9:32 AM
ereOn: it would be valid std::string<struct NodeAttribute>
std::vector that is
 
could it be done with a typedef NodeAttribute Attribute too?
the vector<Attribute> v;?
 
lx
yes
 
@lx thx :)
 
tony: yes, but it shows that you don't know C++ (it's in C++ just for backward compatibility with C)
 
@ereOn I mean you wouldn't get very far, you'd still get errors, but they would be misleading. For example, this generates the same error:
#include <vector>

namespace ns { struct foo {}; }

int main()
{
std::vector<struct foo> v; // meant to be ns::foo
}
 
lx
9:34 AM
you're welcome ;)

(I have to say, this chat is the best online chatsoftware i've ever seen..)
 
But obviously that wasn't the problem in this case.
 
@Gman: Yep indeed. I guess it's a good habit in C++ then, not to elaborate names.
 
cheers all, just checking out the chatroom ;)
 
Cheers :)
 
@6502 oh shit
 
9:36 AM
Hello.
 
so I should avoid using typedef then
 
@Tony Not in general, no.
 
@Tony: No. Avoid using it in that way. But definitely use it where it makes sense.
 
In this case: typedef struct {...}; struct_name, yes. No need.
 
@tony: I think it doesn't pay to use typedef for a struct.... just use struct Attribute {... };
 
9:37 AM
oh ok
is there some rulebook on these kinds of things or something?
 
lx
in this case you could simply name the struct "Attribute" right from the beginning:

struct Attribute { ... };

std::vector<Attribute> attrVec;

in c++ you don't have to typedef structs anymore, to get rid of the "struct" identifier, if you want to instantiate one.
 
@Tony: There's just books. :) stackoverflow.com/questions/388242/…
 
and when passing a struct as a param to a function, do you pass it by ref ?
 
I love how the the picture come and go when someone enters/leaves the channel ;)
 
@ereOn yes its pretty cool :)
 
9:39 AM
@Tony In general, yes.
 
Depends on the structure. Usually, yes.
 
lx
usually you pass it as const reference: void DoSomething(const Attribute& attr)
 
just a struct of strings
 
If you don't need a copy to work with, just pass a reference. The rule of thumb is, pass by reference unless sizeof(T) < sizeof(void*), or T is a fundamental type.
 
lx
in case you don't want to modify it
 
9:41 AM
ok :) cool
 
@gman: i think sometimes this very common "passing a const ref is a cool way to pass a struct" is dangerous, because of aliasing
 
And yes, add const if you aren't going to modify it.
 
lx
if you pass it by value, then alle the contents will get copied, which could be expensive.
in your case it is, since it has to copy the strings
 
@6502 Do explain.
 
in this case I won't modify, but another func will need to modify its member
 
9:41 AM
@gman: for example
 
so I guess then it cannot be const
 
You mean void foo(const T& x, const T& y); // x and y could alias the same object?
 
@lx: Note that the strings usually have short string optimization
@lx So its not mandatorily that expensive
 
@Tony: If your code passes it to code the modifies it, then you effectively modify it.
 
lx
@ereOn: you mean COW?
 
9:42 AM
@lx A built-in buffer.
 
void Rect::xlate(const P2d& delta) { topleft += delta; bottomright += delta; }
 
lx
mh, i see. but as a rule of thumb i would not depend on it. since he is asking for generals, i'd give him that advice ;)
 
@lx: Not sure of what the COW acronym means.
 
lx
@ereOn: copy on write
 
@lx: Thanks. So no.
 
9:43 AM
@gman: in that case there is a strange behaviour if delta is indeed topleft
 
The only COWs i knew about aren't exactly related to computer science :)
 
@6502 Maybe on a bad compiler. I agree it's a problem, but it's not a correctness problem, it's an optimization problem. That is, the code is required to work as you expect but this means the compiler can't perform certain optimizations unless it can prove certain things.
 
lx
@ereOn: Okay. I'm not very familiar with STL optimization internals, since I want to avoid depending on it ;)

suddenly "thereisnocowlevel" pops into my head :p
 
@gman: const means you can't change the value using that reference, not that the value is constant... it can be changed by aliasing
 
C99 introduces restrict for this purpose.
 
9:45 AM
@lx: Fair enough ;) I usually let the compiler deal with such things unless I somehow detect a performance issue somewhere.
 
@gman: sorry, but it's perfectly legal to pass both a reference and a const reference to the same object, and the compiler MUST consider that the const-referenced object may change. a const reference is never an help for the optimizer. const-correctness of references has beed designed as an help for PROGRAMMERS, not for the compiler
 
lx
i see it coming, this chat is sucking all my work productivity away
 
@6502 We agree...I'm not sure what you're arguing.
 
@lx: Lmao. I was thinking exactly the same thing just now !
I typed something like 3 lines in 30 minutes...
 
9:47 AM
I never said a const reference is a helper for the optimizer, I never said it didn't have to consider that situation...please re-read.
You're arguing with someone that isn't there.
 
lx
@ereOn: 3 lines in 30 minutes.. *takes a look at his VC10 window*
that's actually pretty good..
 
@gman: just that in most C++ code I observed const-reference passing is considered the same as optimized value passing, but indeed it's not. There are problems both with lifetime and with aliasing.
 
@6502: Perhaps the only effective solution is to avoid functions and structs at all.
 
Not sure about the problem with lifetime.
 
lx
you should put that in huge sarcasm marks
 
9:49 AM
yeah ;)
 
lx
well, off to lunch... after so much "work" i've earned it
see ya later
 
@gman: that's even more common. The most simple bug of that type is doing v.push_back(v.back()) to duplicate last element of a vector... it's incorrect code with undefined behaviour.
 
Well, that chat is both a blessing and a curse : I love to talk about programing but I love even more keeping my job.
So I'll have to say "goodbye" ;)
Cya.
 
@6502: I'm just nitpicking here but a"const reference" doesn't really exist. All references are "const" in that they cannot be rebound. What you really mean is "reference-to-const".
 
@ereon: simply means that a value is a value, and a reference is a reference (even if const). Those two are separate concepts and you should be careful about the difference
 
9:52 AM
@6502 I'd tick that off as the usual bad library design. That doesn't really have to do with references either. Sure, it's possible because of them, but they aren't causing lifetime issues.
@Frerich We know that const reference doesn't exist, that's why we can unambiguously use it to mean "reference to const". It's shorter.
2
 
yep.
 
@frerich: reference to const is a misleading naming, because as I told before it's not true that the referenced object is const. If I pass a function a const Rect&`it doesn't mean that the referenced rect is constant during the function... just that the compiler should forbid changing the rect using the reference. In `const Rect& the word const is talking of a property of &, not of the rect.
 
@6502 When we're in the situation of saying "reference to const", we're talking about the type, not the object.
The type is a reference to const, regardless of the type of object it's referring to.
 
@gman: ok... but it's the type of the reference, no const-ness is to be assumed about the referenced object
 
...and const is never about immutability; it only ever means that this particular variable may not be used to change that which is const.
 
9:56 AM
hello
 
hello ;-)
 
@6502 Agreed. That's just a common misunderstanding that should be addressed when it arises.
 
can you return a reference to a struct from a function where the struct instance you return is a stack variable?
 
You can, but you get UB.
So don't.
 
@gman: I'm just saying that it's widespread practice to just pass a const reference instead of a value for objects, like if it's the same thing. This leads to subtle bugs because lifetime (e.g. the object referenced disappears in the middle of the function) or aliasing (it mutates). So I don't like saying people "just pass const references around"...
 
9:59 AM
@GMan UB??
 
undefined behavior
 
undefined behaviour
 
oh ok, so what should the struct instance be, a pointer?
 
@gman: I can ensure you that most people wouldn't understand that v.push_back(v.back()) is undefined behaviour.
 
@6502 Understood. I'm also reconsidering the advice in general, now that you mention it. Perhaps for big objects it's a good idea (though with C++0x that could change too), but often it could be faster to work with a local copy (better cache locality and no aliasing), and CPU's are so quick when it comes to copying data anyway...
 
10:00 AM
It's the same thing as passing pointers around 6502. There's not much danger unless you're passing it to an object constructor and retaining it is there?
 
@6502 Yeah, I can definitely see that.
@CiscoIPPhone Scroll up. :) @6502 Brings up several valid subtleties about them.
 
this chat is "dangerous" :-) ... back to work
bye all
 
@6502 See ya.
Man it's 3AM, I should go to bed...
Night.
 
10:16 AM
Ah I see.
 
10:26 AM
is try catch in a constructor a bad idea?
 
Not as far as I know.
 
11:16 AM
@Tony Nothing bad about that. There is also a special syntax for catching exceptions from objects in your constructor's initialization list.
 
Hey ppl , nice thing the chatroom
 
11:40 AM
cool
anybody know if xerces-C++ latest version is still compatible with Xalanc?
 
12:00 PM
I don't know. I use Qt for xml stuff.
 
12:26 PM
this is very cool
 
12:37 PM
so what is the effects of #pragma pack(push,8)
?
anybody here???
 
it sets the data alignment to 8 and pushes the previous value on a stack
 
@Tony: yes, but as you can see on histogram... this time is not popular
 
is there a lot of activity here on peek times? :o
 
New in c++ coming from c#; should i use c++ coding convention that name classes, function and so forth in lower case. or stick with .net coding convention.
 
coding standards depends on where you work
 
12:45 PM
The lower case convention is merely historical, use the one you're used to
 
a programming language does not enforce and convention .. only syntax
@L
 
i = i++;
 
alright its slow here i better i--
cya
 
Anyone have any good example uses of r-value references as defined in TR1 (I'm looking at the GCC TR1 support page here open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html)
 
Did it just get quiet suddenly? There seem to now be a lot more people than there were a couple of minutes ago...
 
1:13 PM
@Sagar people can be afk, you know :-)
 
@Sagar, @MadsElvheim or at work ;)
 
1:38 PM
I'm at work (:
 
1:49 PM
Me too.
 
2:10 PM
anybody can advice on unresolved external linker errors
I've added the include lib in the right places
vs2003
hello???
 
some more details might help; and what do you mean by "I've added the include lib [...]"?
and have you tried posting the question on the main stackoverflow.com site? :)
 
2:31 PM
error LNK2001: unresolved external symbol "__declspec(dllimport) public: static char const * const xercesc_3_1::XMLUni::fgXercescDefaultLocale" (_imp?fgXercescDefaultLocale@XMLUni@xercesc_3_1@@2QBDB)
 
Wow, there are like 8,000 people in here
Ohhhhhhh, there's a huge link at the top of the pages on Stack Overflow...
Certainly a chatty bunch this morning...
 
hello, c++ fans?
 
@James indeed
 
..definitely works.
 
@mlvljr hello there
 
2:42 PM
Hi; so, hehe, anyone considering himself an c++ expert here? :))
//just curious
...8000 honest men obviously :))
 
I doubt it. You'll eventually find a really weird corner case in the language or specification, no matter how proficient you consider yourself in the language.
Proficient or knowledgeable, sure. But expert, no.
 
I've met a few people I'd consider C++ experts; does that count?
 
i have always feared to ask this on SO, but since i've read somewhere that even comm. memebrs (can i call them "offficial experts") had different opinions on some namespace peculiarities, i began to wonder whether it is possible to grasp the standard well enough to be pretty much sure what should happen in each corner case.
@James I've watched some whom I consider experts at youtube, does that? ::)
 
user181351
is this real life?
 
in some sence probably..
 
2:53 PM
@tm1rbrt its fake life... LOL we are all bots
 
I met Stroustrup and Sutter a couple years ago. They seemed to know a bit about the language. Does that count?
 
Guess...
 
That counts.
 
what property of the project in VS2003 does the linker go and look for references to classes, functions etc?
 
this chat is pretty neat.
 
2:57 PM
it is)
 
Does someone know what Microsoft plans to do with C++0x support?
 
Tomaka17, implement it.
 
Are they going to release a service pack or something for MSVC++ 2010 ? Or are we going to wait until MSVC++ 2012 or 2013 ?
 

« first day (9 days earlier)      last day (4931 days later) »