« first day (221 days earlier)      last day (4735 days later) » 

12:00 AM
Yay! Towel Day!
 
@MartinhoFernandes I don't understand fully why but I think gcc may be conforming
I think I should have said "aggregate initialization makes my head hurt" instead
 
Oh, of course! std::array uses aggregate initialization! It has no ctors other than the default generated.
 
 
1 hour later…
1:25 AM
Hey, I was looking at this and was hoping to find some more similar case studies (software architecture case studies). Could anyone tell me if something along these lines would be an "on-topic" SO question?
 
 
3 hours later…
4:20 AM
?
 
 
3 hours later…
6:53 AM
morning y'all!
 
7:30 AM
@TonyTheTiger morning
 
7:55 AM
morning
 
@StackedCrooked How are you today?
 
morning
 
hi good afternoon ..!!
what is the use of this class : RCPtr ?
i heard about this class first time ...
 
Hi
Does anyone have a link to a famous SO question about integral types in C++, their uses, their size ? (sizeof(char) <= sizeof(short) ...)
 
does any one know about "class RCPtr" ?
 
cpx
morning
 
Hi @Miss how are u?
 
sbi
@Nils The usually state could be called "confused".
 
RCPtr seems like a reference counted smart pointer class
 
which state
 
8:10 AM
I don't know about it, but I know boost::shared_ptr is usually perfect
 
why boost, the stl has auto_ptr
 
sbi
@Nils Because that's an odd beast. It moves ownership, rather than copying/sharing it, and you can't use it in STL containers.
 
@ereOn That one?
27
Q: C++ : size of int, long, etc...

JérômeI'm looking for detailed informations regarding the size of basic C++ types. I know that it depends on the architecture (16 bits, 32 bits, 64 bits) and the compiler. But are there any standards ? I'm using Visual Studio 2008 on a 32 bit achitecture. Here is what I get : char : 1 byte short ...

 
sbi
If you want a smart pointer, first look at std/boost::unique_ptr and std/boost::shared_ptr
4
 
+1 for sbi on auto_ptr
 
8:14 AM
@sbi well I haven't used auto ptrs so far, just new and delete
 
@LucDanton: Thanks ! That wasn't the question I wanted, but it contained a link to the answer I was looking for: stackoverflow.com/questions/271076/…
 
sbi
@Nils Well, if there's one thing much worse that std::auto_ptr, it's manual resource mismanagement.
 
@sbi that's why i do it right manually :D
 
@Nils: Any particular reason ?
 
8:16 AM
Smart pointers don't just make coding easier, it also makes it a lot safer
 
sbi
@Nils No, you can't do this "right". There is no such thing as doing resources "right" manually. In any program of sufficient size you will always have bugs in if you attempt to manage resources manually.
 
@nils hi fine thanks
 
@sbi I'm not saying not using some smart pointer is always a good idea, just in my case I didn't see any reason to use them.. and I use valgrind to check for leaks
 
@Nils Exception-safety?
 
sbi
@Nils I'm much more deliberately against that than you are in favor: Not using smart pointers is never a good idea. And I have never seen a reason to not to use them.
 
8:19 AM
@Nils: How do you write exception-safe ?
@LucDanton: You just beat me :/
 
I don't use exceptions in C++
 
sbi
@ereOn Since he's a Swiss he likely writes it in French (which I don't know) or in German (in which case it's "Ausnahmesicherheit). :)
@Nils You don't use new?
 
@nils whats was that?
 
I have someone in my company that hates smart pointers, but he usually writes stupid destructors and clutters our code base with try-catch...
I have someone in my company that hates smart pointers, but he usually writes stupid destructors and clutters our code base with try-catch...
 
hm @nils how did you do that?
 
sbi
8:21 AM
@ereOn People who write such atrocious code should be dragged behind the building and given the chance to either renounce or be shot.
@ereOn So you have two of them?
 
@sbi ?
 
@Miss since pi is a transcendent number the digits look random so if you calculate enough digits you can find a given string of digits in it
 
@nils ahh i see i got it
 
:)
 
@sbi Are you talking about my suboptimal internet connection which forces me to repost everything I said half the time ?
 
sbi
8:23 AM
@ereOn Well, I was talking about you posting twice "I have someone in my company...". :)
 
@ereOn yes, that seems to be what he's referring to
lol
 
well guys it's a bit difficult to explain in a chat, I could probably explain you the problem and show you the whole code and then we could have the discussion on weather or not to use smart pointers..
@ereOn you have your own company?
 
@Nils: I had one. But perhaps my english was a bit off : I wasn't talking about the company I own, but the one I work for.
 
ah
 
sbi
@Nils If I'd be involved in that discussion, I know my opinion after seeing your code before I even saw the code: use smart pointers.
 
8:24 AM
@sbi epic :)
 
@Nils: I just don't understand your rationale about smart pointers. When I learnt programming, I was happy to deal with new/delete because I felt smart doing so
 
typedef new smart_pointer
 
But after some time I realized it wasn't that difficult and it was actually risky to handle that manually
when facilities existed to leave all the burden
 
sbi
@ereOn You can edit your messages for (I think) 2mins. (This, and other things are explained in the newbie hints, linked in bold text on the right.)
 
probably doesn't work I would have to use #define
@ereOn I haven't said it's not a good thing, neither you should not use it in many cases
just for my case it does not make sense
 
8:26 AM
@sbi: Thanks. Didn't know that. Havent used the chat much.
 
@Nils The 'entry level' smart pointers are very easy to use and buy you so much over raw pointers at no cost at all
 
so I have to go to work, because debugging w/o smart pointers will obviously take much more time ;)
 
@Nils: Now I'm curious about what your case is. To me, the only reason not to use smart pointers is when you are actually designing a smart pointer class.
 
well it's a particle engine for a cfd package which works on the gpu
so I have to flatten the classes and store them in std::vector
then I upload them to the gpu using raw pointers (see stackoverflow.com/questions/6114657/…) with CUDA there is very limited C++ support on the device side, so I use C style pointers and arrays there
 
The weird thing is that you seem to use std::vector which probably have more overhead than a simple smart pointer (well... it doesn't have much overhead, but still a bit more than a smart pointer)
 
8:31 AM
@Nils The (very) long version regarding smart pointers is this: "use smart pointers over raw pointers for ownership". You do not give up on e.g. passing raw pointers
Of course if the code on board has to deal with ownership then that bit of code will do things the old-fashioned way
 
I use vectors, because they also store the size and I can access them using bounds checking on the host side
 
it doesn't mean all of the code has to (but then again I'm not familiar with your platform)
 
Well I put boost::shared_ptr on my to study list
 
@nils do you know about "class VectorPool" ?
 
no where did you find it?
 
sbi
8:36 AM
@Nils That statement doesn't make sense.
From 2001 to 2008 I have been maintaining a piece of code that's likely to be installed on your machine (as well as on 5 million others). It's heavily cross-platform (Win32, OSX, Linux, BSD, Solaris, Sparc, AIX...), and writes and reads XML files across all those platforms. It loads a four-digit number of those files at startup, and needs to do that very fast.
 
it used in code ..and i found that code from net ...
 
sbi
For a Usenet discussion I once greped the sources for delete. Back then, it was >100kLoC, and I found one single delete in that code. It was in the destructor of a class that managed a dynamically loaded object. (So basically, that class was a smart pointer.) However, my code was just a small part of the several-million LoC project, and different parts were written in different styles.
 
let me search this
@nils : see koders.com/cpp/…
 
@sbi Well OpenFOAM also comes with it's own implementation of smart pointer I will have to decide between this one and boosts
 
@sbi: What have you been working on ?
 
8:43 AM
@Miss In what context is that used?
 
sbi
@ereOn Sorry, but I value my anonymity. :(
 
morning
 
@nils i have to do work/.. lets see it latter
 
@sbi: ^^ I understand.
 
@Miss me too
 
8:44 AM
ok see ya good bye from chat room C++ ..
 
@DeadMG moring
 
moring ?
 
@TonyTheTiger Try (yet) again :P
 
@DeadMG morning
@MartinhoFernandes epic fail on my part! ugh :(
 
Good morning :)
 
8:57 AM
you know, you responded to the same message twice :P
 
does any one know about this include file : "#include <data-flow/include/misc.h>"
 
@DeadMG the first one was misspelled
lol
 
lol
 
@nils no one will reply me.. i guess my question is strange, do you know about this include file : "#include <data-flow/include/misc.h>"
 
7K rep :)
 
9:10 AM
GG
 
sbi
@TonyTheTiger Cong rats and other rodents!
 
Viet-Cong rats?
 
@lucdanton: do you know about "#include <data-flow/include/misc.h>"
include file ?
ahh i found it . i think i should not share things on SO chat room...
 
9:59 AM
@sbi :)
 
ok
now I have a question
 
oh now you do eh? :P
 
I've got an abstraction over an immutable object
but I just realized that I really don't like the way that it's been written
as I basically just pretended that it's a mutable object
 
toooooooo much food and too much beer
 
10:00 AM
my stomach is immutable but i pretended it was mutable
 
oh, you think you have stomach problems? talking to the master here
 
interesting :)
 
beer is never a problem…
 
it can make you drunk though... not a problem?
 
I think that instead of providing an API function to explicitly reset the immutable object
 
10:01 AM
nope, i'm a friendly drunk
 
I should simply mark it as dirty and re-create it before next use
 
copy on write… COW… delicious
 
so no API to reset?
 
yeah
 
so you don't want to give users of your object that control?
 
10:02 AM
cause honestly, I know exactly when the next use is, and there's no reason to dick around with this when I could just handle it for the user
 
hmmm I guess
but a mutable wrapper around an immutable object, sounds iffy
 
like i said, copy on write
 
true, but I'd rather not write an immutable wrapper and then find that some implementations involve mutable objects
no way am I going to copy on write
 
no COW for you @Potatoswatter
 
yeah
I think that the "dirty" mark is the best way to go
 
10:04 AM
*shrug*… "suit yourself"
 
hmmm, I'm no expert, but sounds ok
 
but now my object's API is just a bunch of getters and setters
 
ugh :(
is this .NET?
 
no
 
is there no better abstraction then get/set?
 
10:06 AM
not that comes to mind
 
yea, abstractions can be difficult to get right
 
is the client const-safe?
 
oh well
no, actually
I completely didn't use any kind of const
 
ah, that makes COW much harder
but on the other hand, (maybe) you could just solve the const problem before it gets even worse
 
I'm not going to COW in any case, so stop talking about it
I've heard a lot of blah blah about const, but it's never helped me in the slightest, and just irritated me with refusing to work, because the language and libraries push it on me
 
10:08 AM
lol… you're just going to make a new object if the dirty mark is set, that's all…
 
no, I'm going to replace an immutable internal implementation detail
 
isn't that like COW? (merely curious)
 
I'm not going to make a new object or a copy of anything
 
oh I see
 
10:09 AM
and
I'm going to replace it if it's dirty at a very specific time, just before I know it's due to be used, instead of just randomly on write
 
but what's triggering the dirty bit?
 
a write
what else can make it dirty?
I should stop thinking about this, I keep coming up with new designs
and ultimately they're pretty fuckin' equal
 
10:26 AM
does any one know about data flow class ?
 
10:38 AM
LOL
 
10:48 AM
that's when data flows in style

like, with bling.
 
11:01 AM
We have a bug we can't fix because it is now used as a workaround to another bug that is too troublesome to fix but not problematic, because we have a workaround for it.
 
are char[] = "some string"'; automatically zero terminated in C?
 
Yes, and in C++ too.
 
@MartinhoFernandes uh? confusing...
@MartinhoFernandes ok thx, wasn't sure
 
@Martinho: lols
 
11:29 AM
why is it that Microsoft implement so many rendering technologies, all of which are incompatible?
can't have D3D and WPF, or WPF and Win32, or D3D and D2D
 
I thought WPF used D3D.
 
it does
apparently, that doesn't mean that you can actually use them together
 
cpx
hmm have you ever thought about when you say C++, do we refer to C++03?
 
the trouble is that WPF encapsulates all rendering and message handling
so if you have a normal loop that looks like, say, while(DoMessages()) { Render(); DoSim(); }, there's no obvious place for WPF to go
 
hmmm that's interesting
 
11:34 AM
and WPF provides a kind of D3D interop class
but it's far from "here's a HWND, go nuts"
 
Can't you do it the other way around? Put some D3D inside your WPF instead of WPF inside your D3D?
 
you have to start messing around with surfaces and stuff
 
@DeadMG That's what I was expecting. You add some D3D canvas or something to the part of the window you want to use and it gives you a handle for you to play as you wish.
Otherwise it sucks.
 
yeah, you can't do that, although I sure wish you could
I guess the fundamental trouble is that a C++ game loop looks very different to how .NET handlers work
there's a lot of auto-generated "magic" going on on the .NET side
I mean, they're practically blitting bits across manually here
I checked wxWidgets out and they seem to be a fugly mess too
 
oh gosh
 
11:40 AM
Does that use native stuffs? I mean, almost all GTK apps I've used on Windows are bastard children that do not play well with things like DPI/locale/RTL settings. Does wxWidgets suffer the same problem?
 
why do you want to mix D3D with WPF anyways?
 
@Tony: Because WPF is a pretty good UI toolkit
why else
@Martinho: I don't know, the problem is that it's abstracted to all hell and there's no mention of HWNDs or DirectX anywhere in the documentation
 
but I thought your Engine was supposed to do it's own UI
unless you're working on something else
 
it is, but that sucks
 
@DeadMG It's supposed to be portable, so I don't find that expectable.
 
11:42 AM
for a start, I'd have to implement a lot of UI stuff myself, and the result wouldn't be as good
I know
 
use sfml
 
that's why I hate portable code
SFML actually doesn't look like that bad a choice
but they only want to support OGL
although I'm not actually sure that it's OGL specific
 
hello :)
 
hello :)
 
cpx
hallo :)
 
11:50 AM
hello :)
 
however, I'm not terrifically impressed that they want me to manually call Draw() for everything I might want to draw
 
@DeadMG wrap it - abstract it away
 
yeah
maybe I will just stick with my own
 
That's the spirit: Don't reinvent the wheel, but don't try to fit a triangular wheel on a round hole.
 
yeah
 
12:02 PM
yeah
triangular wheel? hmmmm
interesting combination of words...
 
a triangular wheel could still have a round hole in the centre?
 
somewhat triangular
 
cpx
hmm
 
Interesing
But it's a triangular wheel made up of round wheels
 
does .NET support virtual properties?
 
12:10 PM
yes
 
(menewb) What would be the advantage of virtual properties?
Hmm Properties = getters/setters?
In which case how do they differ from a normal function (and hence not be virtualable like a normal function?)
 
12:32 PM
Why does this not work?
// UniversalVector extends std::vector
UniversalVector<int> vec(3);

std::vector<int>& stdVecRef = dynamic_cast<std::vector<int&> >(vec);
 
@Nils deriving from containers is not considered a good idea in C++
 
blah
 
what problem are you trying to solve by deriving from std::vector?
 
Well then UniversalVector requires the cuda compiler to compile
and stuff
 
cpx
hmm
 
12:35 PM
so I need a reference to a cast to std::vector which I can pass to parts of the program not compiled w cuda
 
cpx
btw I think you need to fix that address of operator inside dynamic cast
 
d'ouh
yeah that's the problem I guess
it's not an address operator
 
cpx
what do you call it?
 
reference operator
?
ampersand
 
cpx
:)
 
12:37 PM
thx @cpx
 
@Nils Since it is an upcast the conversion can be implicit
 
12:55 PM
ah
 
Hello. I have a question.
I have this method. short cmd_Draw2DPoly(short ThreeDmode, sds_point startpoint[]){...}
and I call it like this in another class cmd_Draw2DPoly(0, startpoint);
and it says cmds error C3861: 'cmd_Draw2DPoly': identifier not found, even with argument-dependent lookup
someone knows what is wrong?
 
www.stackoverflow.com
 
ADL applies to freestanding functions, not members
 
How can I move the content of one std::vector to another w/o having to copy the whole memory? There is swap, but I don't think it's the right thing to use..
 
??
 
12:57 PM
@Nils: So, you don't want to copy, and you don't want to swap, so what do you want?
move semantics?
 
@cyberrog if the function is a non-static member (you mentioned it is a method) ADL has nothing to do with your problem. You also need an object to call the method.
 
ah yes quite a dumb question, so I would have two vector with the same underlying data..
 
@LucDanton its static
 
@cyberrog Is the call qualified? It doesn't seem to be in your description
 
@LucDanton it is. I already called this method before. And the error didnt show up.
Im gonna post the question on SO
0
Q: Identifier not found, even with argument-dependent lookup

cyberrogI have this method. short cmd_Draw2DPoly(short ThreeDmode, sds_point startpoint[]){...} and I call it like this in another class cmd_Draw2DPoly(0, startpoint); and this error show up error C3861: 'cmd_Draw2DPoly': identifier not found, even with argument-dependent lookup Someone k...

 
1:05 PM
I see now that the ADL bit is part of the original warning; that's kinda cute and unhelpful in a passive-aggressive way
 
@LucDanton should I use exter to declare the function??
 
You claim it is a method; it is not possible to declare a function member extern
If however it is a static but freestanding function then yes, that can be a problem
If the prototype looks exactly how it appears in your question (and it's not a member) then it already has external linkage. Is it in an anonymous namespace?
 
it says the class has been globalized
it is not my code, im just trying to use this method
 
 
2 hours later…
3:35 PM
hey anybody there
 
cpx
hi
 
hey ..do u know how to code in mex?
its matlab with c++
please help :(
 
cpx
hmm
 
u know or not?
hello pls reply
 
cpx
you should ask or post your question on SO :)
 
3:40 PM
i did
 
I've been reading the boost.asio docs and call/cc and CPS keep coming to mind. I'm not completely off the mark, am I?
 
but problem is the replies are coming in to slow
so i would prefer to talk to someone whose online :)
@MartinhoFernandes ?
 
1
Q: Executing a user-mode executable from kernel-mode

eladidanI'm building a HW-simulator for our driver team. Now, the simulator is devided in to 2 modules: First module runs inside the driver, in kernel mode and that's where the main interface between the driver and the HW-Simulator. Second module is an executable user-mode code which generates data for ...

@rohit what is your question?
 
1
Q: Mex sparse matrix

rohitI created a sparse matrix in mex using mxCreateSparse. mxArray *W; W=mxCreateSparse(n*n,n*n,xsize,mxREAL); double *wpoint; wpoint=mxGetPr(W); for(p=0;p<xsize;p++) { Wpoint[(returnindex1(xi[p][0],xi[p][1])-1)*n*n + (returnindex1(xj[p][0],xj[p][1]))]= exp(-df[p]/(SIGMAI*SIGMAI)) * exp(-...

 
@rohit someone answered it
 
3:44 PM
but i dint understand
 
> That's the executive summary, but I recommend that you read up on the details more carefully.
 
if u could explain it wud be great helpful
:)
 
I don't know matlab
but you need to understand how matlab stores your sparse matrix
 
that was my 1st question
 
so have you looked that up?
 
3:46 PM
i couldnt understnad
i tried reading
but dint understand
 
but i want in mex
 
you should at least try do some research, cause imho you haven't tried hard enough
 
@Tony Hey, you're sniffing my google results!
 
@MartinhoFernandes lol
 
3:49 PM
i tried
but i cant understand
 
We can't understand it for you either.
 
then find what it is you don't understand in the document and look it up
 
oh
 
we're not gonna solve it for you
so don't even expect that
 
k
 
3:50 PM
(Look who broke 10k mark and got shiny new toys!)
 
@CatPlusPlus nice :)
 
cpx
I saw that.
 
I didn't find those specific toys particularly useful
 
hehe
I'm still battling to get there...
 
They're not that great :( You'll quickly realize people flag all kinds of non-flag-y content, and you can also find crap posts faster. Yay.
 
3:54 PM
But still.
Shiny, new!
 
Anyway:
15 mins ago, by Martinho Fernandes
I've been reading the boost.asio docs and call/cc and CPS keep coming to mind. I'm not completely off the mark, am I?
 
wtf even is call/cc or CPS?
 
Continuation-passing style.
 
the Crown Prosecution Service?
I still don't know what that means :P
 
Oh god that exists!
 
In functional programming, continuation-passing style (CPS) is a style of programming in which control is passed explicitly in the form of a continuation. Gerald Jay Sussman and Guy L. Steele, Jr. coined the phrase in AI Memo 349 (1975), which sets out the first version of the Scheme programming language. Instead of "returning" values as in the more familiar direct style, a function written in continuation-passing style takes an explicit "continuation" argument, i.e. a function which is meant to receive the result of the computation performed within the original function. Similarly, when...
 
I can't really explain it simply. Because it isn't particularly simple. But Wikipedia knows, and she told Google about it ;)
 
And then Bing stole it.
 

« first day (221 days earlier)      last day (4735 days later) »