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

06:44
@JamesMcNellis I just saw your edit, haha.
07:00
@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.
07:40
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
07:55
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
08:04
ya
08:28
it fixed it
:) @Gman
08:47
yay :)
09:09
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?
09:17
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.
09:20
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
09:21
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.
09:26
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?
09:29
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
lx
09:30
ah... Attribute is an actual instance of that struct
Is there a typedef there? As in typedef struct NodeAttribute { ... } Attribute?
lx
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. ;)
09:32
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
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
lx
09:34
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
09:36
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 {... };
09:37
oh ok
is there some rulebook on these kinds of things or something?
lx
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 :)
09:39
@Tony In general, yes.
Depends on the structure. Usually, yes.
lx
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
lx
in case you don't want to modify it
09:41
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
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
09:41
@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
lx
@ereOn: you mean COW?
09:42
@lx A built-in buffer.
void Rect::xlate(const P2d& delta) { topleft += delta; bottomright += delta; }
lx
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
lx
@ereOn: copy on write
@lx: Thanks. So no.
09:43
@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
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.
09:45
@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
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...
09:47
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
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
lx
you should put that in huge sarcasm marks
09:49
yeah ;)
lx
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
09:52
@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
@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.
09:56
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"...
09:59
@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
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
Ah I see.
10:26
is try catch in a constructor a bad idea?
Not as far as I know.
11:16
@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
cool
anybody know if xerces-C++ latest version is still compatible with Xalanc?
12:00
I don't know. I use Qt for xml stuff.
12:26
this is very cool
12:37
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
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...
13:13
@Sagar people can be afk, you know :-)
@Sagar, @MadsElvheim or at work ;)
13:38
I'm at work (:
13:49
Me too.
14:10
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? :)
14:31
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
14:42
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..
14:53
@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.
14:57
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 (5160 days later) »