« first day (489 days earlier)      last day (4458 days later) » 

3:00 PM
But they're also extremely powerful at parallel processing in general, so you can do raytracing pretty well too
you just have to do more work yourself, and you won't be able to take advantage of some of the more specialized hardware features
 
@jalf How much branching is there in ray-tracing? I figure it has to have some since you need to check when a ray hits something.
 
@daknøk ray tracing is ray tracing. However, I know that several games use it to do dynamic lighting.
Which that isn't as hard to do.
 
@Mysticial Hmm, not sure, I'm not an expert. Why?
 
First, test distance, if object is within tolerant distance of dynamic light, then cast rays (only from surfaces facing light).
 
GPUs suck at branching. Though I have heard of ray-tracers for GPUs.
 
3:05 PM
obviously, a GPU isn't particularly happy with branching, butit shouldn't be a big problem, especially since it's still nicely localized (all rays going in the same rough direction are likely to hit the same object, so the branches will turn out the same way)
 
@jalf Yes, that's true, unless it happens to be on an edge, entire warps will go the same way.
 
How does raster render intersects? I mean, you can order objects so they render from back to front, but how do you accurately render intersecting polygons?
@jalf Alternatively, you could render a radial shadowmap from the point of the lightsource, and then you don't have to raytrace. Not sure how hard that would be?
 
@Xaade Depth buffering on the per-pixel level.
All you have to do is interpolate the pixels and then the ones which are covered will be rejected by the depth buffer test
 
@DeadMG Is that process akin to a raytrace?
 
@AlfPSteinbach Thanks @Alf. I believe my answer on that question is essentially the same as your interpretation of that code.
 
3:10 PM
no
 
@DeadMG Well, ok. So you check per pixel on the screen, you render two polygons and determine an intersection, how do you determine where that pixel lies in space. You'd trace a ray to determine which object it collides with?
 
@Xaade You already know where the pixel lies in space.
you don't have to determine any intersections
you project each vertex, and then the position of each generated pixel is a relatively trivial interpolation between the vertices
 
you just take a polygon, determine which pixels on the screen it would cover, and then you fill in each of those pixels, checking against the depth buffer for each. If there's already a value on that pixel closer to the camera, you skip it instead of updating it
so usually you try to render front to back, not back to front, but that's just an optimization because you avoid having to update the same pixels too often
 
3:29 PM
would anyone happen to know of a way to estimate memory usage based on source code and compiler output?
 
impossible
 
@Xaade actually projection is typically not done immediately to 2D but to a 3D cube (-1,-1,-1)x(1,1,1) (also known as NDC). In this space you can perfectly do the z-buffering because all pixels that will need to blend in your 2D projection will have same x,y coordinate but different z-coordinate, whether they intersect or not.
 
@phill I think that's pretty much another way of stating the halting problem
 
He said estimate, not exact
 
that's still impossible
 
3:36 PM
@Pubby you can't estimate an answer to the halting problem :)
 
Yeah you can, the probability is just 50/50
 
no, that's wrong
 
?
 
how can you tell a halting program from a program that uses nearly infinite run-time and then returns?
you'd have no way to know if you were correct with your guess of whether or not it halts
 
Oh, right
 
3:38 PM
the best you could do for this case would be to run it and record the results and build a probabilistic map, but there's always an unexpected case - it's why schedulers struggle too
 
Problem is I can't record anything. The process is run on an embedded device running an OS with no tools
and the client still wants something, even an estimate, that makes it look like it won't chew up all the memory.
 
you could prove it using formal methods if the code was simple enough :)
 
@phill You will just have to tell them that it cannot be done.
oh yeah, technically, it can be proved correct
but that's not feasible for non-trivial programs, in reality
 
a code review is probably your best bet
 
@phill: can't you run it somewhere on a non-embedded platform also and use it's usage there as an estimate?
 
3:41 PM
@phill Use an emulator?
 
i.e. we have one tight loop, it calls these functions which don't allocate ever would make your client happy
 
@DeadMG oh. I always assumed they just skewed the imaged to match the polygon.
 
@Xaade Nope.
you interpolate the pixel's position in space, then you interp all the other per-vertex data like texture co-ordinates, then you colour the pixel based on that data, and voila
 
with an emulator you can brute-force it, e.g. with 1,000,000 hours of execution with realistic and random inputs it never exceeded X
 
but the time would be better spent simply reviewing the code
 
3:43 PM
sadly, things have been designed for a proprietary OS so running it on something else is not trivial. Plus emulators have not been provided.
 
or, more realistically, use language features which prove that you don't leak
like RAII
 
@DeadMG that doesn't prove you don't push_back every 5 min though
or have shared_ptr loops
 
sure, but that kind of between-state logical leak is much easier to track down and find
 
@phill so write your own OS, and provide identical APIs!
@DeadMG ah.... in .NET that would be "using" statements. Fun stuff.
 
@Xaade Nah. using is really quite broken and not at all on the same scale.
 
3:46 PM
@DeadMG how is it broken. (not defending, genuinely need to know). AFAIK it simply disposes the used parameters at the end of the scope.
 
Is there a way to get the T and the U from boost::function<T(U)> ?
 
first, if you need IDisposable, then all of your base classes and interfaces need to be IDisposable, just in case
second, the compiler won't generate your Dispose method for you and dispose all the Disposable member variables
oh yeah, and you'd have to implement all your own reference counting, etc, semantics from scratch
 
@DeadMG Well, alternatively, you could write some delegate use.
 
// Doesn't work :/
template<template <class Signature_> class Function>
struct Dissect { typedef Signature_ Signature; };
 
ReadFile(File file, Action do) { file.Read(); do.Invoke(); file.Close(); }
 
3:49 PM
@Xaade What delegate? There is no delegate that will stop me from doing NonDisposingInterface x = new NeedsDisposingBase(); return;
@Xaade That's just using with a library implementation. It doesn't change the fact that file has to be known to need closing.
 
@DeadMG the pitfall of GC.
 
@StackedCrooked that would be expecting boost::function without any specific signature
 
oh yeah, and using won't insert itself, so all your generic code = byebye, we don't play nice with types that need Dispose
@Xaade Yeah- that it sucks :)
 
you can do it with a partial specialisation though I think, hang on
 
After I watched Bjarne talk about RAII, I suddenly had this pit in my stomach that felt like the concept of GC becoming this huge unmanageable weight.
 
3:51 PM
it is
 
@Xaade not sure anyone on the dev team would go along with "lets build our own OS while we develop this larger system so I can get mem usage stats"
 
GC is nice but it's so incredibly unflexible, it's not even funny
 
@awoodland I have this sample. In case you want something to start from..
 
@DeadMG Again, that's where lambdas become a better alternative. Not saying GC is superior, just saying that you can get it work.
 
Oh, misread :)
 
3:52 PM
@Xaade What do lambdas have to do with GC?
 
@DeadMG It would be nice if you had the alternative. Like, say you know you can tag this class for GC, but this other class, you'd like to use RAII.
Of course, you could use value types :P
 
the problem with that is simple
raii_class x { gc_class y; }
now you have to start tracing the whole native heap, too
 
@DeadMG You create methods that do the RAII work for you, then you call the method and pass it a lambda that uses the resource. Then you don't have to implement dispose.
However, you get stuck with an ordering problem.
 
@Xaade That's no different at all. You still have to actively know when and how to do it.
 
You have to figure out what order to dispose resources, and if you get in a situation where you need a resource to persist after but instantiate after another user, you get stuck.
 
3:55 PM
the fundamental problem of using is that there are non-Disposable classes, and that using is not applied automatically
 
@StackedCrooked ideone.com/0HpZC
worked on my machine although there's no boost on ideone
 
@awoodland Lol, it's so simple. Why didn't I think of that?
@awoodland Thanks!
 
@DeadMG That's no different than needing to know how to code your resource users to release upon death. You just write a wrapper that does that for you. Instead of in the destructor, you put the release at the end of the lambda user. That's no different. The difference is ordering. You have to use hierarchical ordering with C#, where you can release in unspecified order with RAII.
 
@awoodland Did you tell the compiler to include the boost path?
 
@Damian can you do that on ideone?
 
3:57 PM
@Xaade No, the difference is that in RAII, the type creator writes the resource cleanup once. And then correct cleanup is guaranteed, now and for all time.
with using and your call-with-disposable system the user has to write the resource cleanup code every time.
which means knowing when to write it, and having interfaces that offer it- both of which are using's existing problems.
 
@awoodland Don't think so.. Boost is non standard anyway.
 
call-with-disposable is pretty identical to using, the only difference is that with using the lambda is inlined.
 
@Damian the question was about boost::function - I built it fine on my machine where I have that
(it worked with std::function on my machine too but I forgot to include iostream which shockingly gets pulled in by boost/function.hpp)
 
user406009
It always seems like the boost headers grab a bunch of the c++ stdlib while they are at it.
 
@awoodland Why on earth would boost::function need <iostream>?
 
4:01 PM
@DeadMG this post uses boost and works ideone.com/rUmzH
 
@DeadMG beats me - it also pulled in <typeinfo> though which I forgot but remembered before I uploaded to ideone
 
that's not a shocker
probably depends on RTTI internally
or for some debug function
 
@Damian that post is language C++, not C++0x which might explain it
 
@awoodland hmm.. they need to add the C++11 flag.. to their compiler..
 
is there actually a version of gcc that calls it 11 not 0x yet?
that's actually gcc 4.5 which is pretty ancient in terms of C++11
 
4:04 PM
@awoodland I think you can do that in 4.7
 
@awoodland ideone.com/samples this page mentions gcc c++0x
@awoodland so must be a bug in their setup..
 
their c++0x/11 support just mirrors the gcc versions they're using
 
Als
4:24 PM
hmm
 
hmmmm
 
user784668
hmmmmmm
 
is that a 50Hz mains hmm?
 
4:39 PM
hi all again! :) In Moscow it's evening and what about your places? :)
 
Als
hmmmmmmmm
 
user784668
hmmmmmmmmmm
 
hmmmmmmmmmmmm
 
it seems somebody got bored
 
user784668
@MrAnubis You failed.
 
4:52 PM
@Fanael lol, why?
 
user784668
@MrAnubis One 'm' too much.
 
@Fanael edited , pass me now ?
 
user784668
@MrAnubis Dunno.
 
Als
huh
NSFW
 
user784668
Work is NSFW.
 
4:55 PM
oh pron
 
user784668
@TonyTheLion I knew you'll show up.
 
it's Holly Weber, google her
 
@user1131997 Aww , it's you?
 
@MrAnubis it's Holle Weber, upper
*Holly
 
It's @TonyTheLion's Copyright to post pron here, He might'll stalk you then shoot you :D
 
5:01 PM
Pron? tits are not 100% able for looking, it's not pron by the law, just erotic
pron != erotic
 
C++ Y U NO LIKE LADIES
3
 
lulz
 
user784668
@user1131997 Prawn != erotic? That's quite obvious.
 
@Fanael it will be pron if you can see nipples or act of sex with details
 
@user1131997 but erotic ⊂ porn, isn't it?
 
user784668
5:03 PM
@user1131997 That would be porn, not prawn.
 
if nipples are closed for looking and the is not open-source sex-scene, it just erotic
 
Hahaha.
 
@MrAnubis including != equaling
 
I just realized what Fanael is talking about.
crustaceans ftw!
 
@robjb and about what does he speak? :)
 
user784668
5:04 PM
Prawns are decapod crustaceans of the suborder Dendrobranchiata. There are 540 extant species, in seven families, and a fossil record extending back to the Devonian. They differ from other, similar crustaceans, such as Caridea (shrimp) and Stenopodidea (boxer shrimp) by the branching form of the gills and by the fact that they do not brood their eggs, but release them directly into the water. They may reach a length of over and a mass of , and are widely fished and farmed for human consumption. Shrimp and prawns While in biological terms shrimps and prawns belong to different suborders...
 
I wonder if prawn is as tasty as shrimp
 
huh I always thought shrimp was what Americans called prawns
 
@MrAnubis lol
 
according to wikipedia everybody is wrong
 
Yea, en.wikipedia.org/wiki/Caridea describes actual biological distinction
 
5:17 PM
(remove) all the things
 
hi
 
@CatPlusPlus the Lounge<C++> wiki page says I'm supposed to ping you after I join the site
 
@sbi stackoverflow.com/questions/2139224/… You are becoming famous. My TL has asked me to follow your guidelines mentioned here.
 
@user1131997 Darkenet arriving here in London
darkness
 
5:32 PM
How does everyone handle null pointers passed as a function argument? Log an error and indicate failure with the function return value? Throw a custom exception?
 
@SethCarnegie ping
@robjb Depends.. low level I ternd to use exceptions and higher level I have errors and return empty objects..
Exceptions are not optimized so slow
avoid them where you can..
avoid
 
is there even a way to to get the number of cache misses?
 
o_0
 
which cache? level 2
@TonyTheLion Intel Vtune?
 
@Damian That approach sounds sensible... btw you can edit your posts in here :p
 
5:35 PM
@robjb cool!
 
user784668
@TonyTheLion What CPU are you using?
 
@Damian click the down arrow to the left of your message and click edit
 
@TonyTheLion Los Intel?
 
within the time limit
 
@SethCarnegie cheers
 
5:37 PM
@Fanael Intel Core i7
 
user784668
@TonyTheLion Then use Intel VTune.
 
user784668
@TonyTheLion On AMD CPUs, you need AMD CodeAnalyst instead.
 
@robjb change T* arg to T& arg if arg can't be nullptr.
 
@Abyx Ooh, I like that a lot more.
 
5:42 PM
... or just add assert(arg != nullptr); at beginning of function. It will document that program won't work with such arg value
 
there's little reason to accept a pointer if it can't be null
 
legacy API. it's not a little reason, it's 95% of existing code.
or API compatible with C
 
5:58 PM
gah! I hate profilers :/
My vector code is slower than my map code when I time it. Whenever I use MSVC's profiler, it reverses.
 
profiler's smarter
 
???
Can I summon the bin master?
 
that's normally @DeadMG isn't it?
 
2 messages moved to bin
 
Hmm, no TR2 but instead lots of mini TRs
 
6:28 PM
hm... this room looks sorta empty. no big images with dead animals, no noobish questions on C.
 
user784668
@Abyx You want a noobish question on C? Why void main(void) is frowned upon?
 
@Abyx What do pointers point with?
 
user784668
Of course I know the answer, but you wanted a noobish question :P
 
@Fanael I don't know C
@SamDeHaan and English too...
 
user784668
@SamDeHaan They point with an arrow, if that's what you mean.
 
sbi
6:31 PM
@Mahesh Who is your "TL"?
 
user784668
@SamDeHaan More on arrows: haskell.org/haskellwiki/Arrow :P
 
@sbi Team Leader?
 
@Fanael I haven't taken the time to learn haskell yet. Seems interesting.
 
+ -- it's an arrow.
 
sbi
@Abyx Yeah, that might indeed be the meaning.
 
6:34 PM
@SamDeHaan if you've done much TMP then Haskell is like a heavenly vision :)
 
Two Letter acronym ("TL")
 
sbi
Also, there's a Haskell room to chat about the language.
 
there are same Cat
It seems all other rooms are almost empty, and all people in SO chat are here
anyway when people want to ask something in chat, they go here. even mods.
 
I'd always assumed the Java Script and PHP rooms were popular from the number of flags they get, but maybe people only go in there to flag
 
user784668
@awoodland This is likely to be true for the PHP room.
 
user784668
6:44 PM
I mean, PHP is a strong swearword.
 
Teachers and books need to go in more detail about unicode, because people just don't get it
 
user784668
@MooingDuck Unicode itself is too abstract, they won't get it. It doesn't even say how the darn characters are encoded.
 
@MooingDuck I think unicode support in many languages is suboptimal too which prevents people from embracing it
 
sbi
@Abyx Yeah, and then the mods stay here for days, keeping an eye on us. Fortunately, now I can't see a mod here anymore.
 
Ell
I don't even know what a character encoding is :O
 
user784668
6:47 PM
@Ell It's a weird way to say "this thing is going to screw you program if properly (mis)used".
 
@MooingDuck when you teach algorithms only then Unicode looks like an irrelevant detail
 
Ell
Is ascii a character encoding?
 
user784668
Oh, and by the way: in UTF-7, + is encoded as +-.
 
@sbi just wait for another "WTF?!" question on meta SO and they will come
 
user784668
@Ell Yeah.
 
Ell
6:48 PM
I don't see how character encodings mess up files, surely character encodings are irrelevant and files are just a bunch of bytes?
 
@Fanael I don't care if unicode is good, I don't care if language support is optimal, I care that it's the best standard we got, and people haven't the foggiest idea of what it is
@Ell the character encodings are very relevant, or files are just a bunch of bytes.
 
user784668
@MooingDuck I'm not saying about that.
 
Without an encoding, you have no idea what those bytes represent. So if you want to open the file, the encoding is very important
 
user784668
@MooingDuck I say that they're not likely to get it anyway. Because it's too abstract for them to understand.
 
I started the SOFAQ: loungecpp.wikidot.com/faq
 
Ell
6:50 PM
@MooingDuck so if you're storing binary data or numbers it doesn't matter, but as soon as there is text it becomes relevant?
 
@Fanael I would be happy if they simply told everyone that there are 6+ unicode character encodings, that would be awesome
 
Tell me what you guys think
 
@Ell encodings/formats go for all data, text or no
 
Ell
@MooingDuck but I don't understand, If i have, say, an unsigned integer and I dump that to a file, why does it need an encoding? Its just binary data?
 
@Ell one unsigned integer is the encoding.
 
user784668
6:51 PM
@MooingDuck That'dn't be much helpful. How is this knowledge going to help if they know naught about how complicated Unicode can get, and about how these encodings actually work?
 
@Ell otherwise I'd never know if it was a 4 character string
 
Ell
@MooingDuck ahh okay
 
@Fanael because then they'd stop assuming that unicode means UTF16LE, and being confused when given anything else
 
Ell
shouldn't unicode support be abstracted away? So an std::string is a unicode string. or an ascii string. or which ever works?
 
@Ell it's not that simple, but we keep trying
 
user784668
6:53 PM
@MooingDuck Okay, you have a good point.
 
@Fanael of course, MSVC doesn't help when it's options are "Unicode" "multibyte" and "None"
 
Ell
@MooingDuck is that why we have wchar_t, etc.?
 
user784668
@Ell How would you do that?
 
user784668
@MooingDuck That's more about Windows headers, but yeah.
 
@Ell that was why we added wchar_t, before Unicode was standardized, and we realized that wchar_t was a really bad idea
@Fanael and in the compiler options, but yes. It just adds to the confusion
 
user784668
6:55 PM
@MooingDuck They just #define appropriate macros. You can do the same without these switches.
 
@Ell sometimes a unicode code-point takes several wchar_t, and several codepoints go into a "glyph" on the screen.
 
Ell
@MooingDuck so if you could rewrite c++ from scratch in a day, how would you have it?
 
@Fanael my point is the names are highly misleading
 
Ell
I think I need to look up glyphs and codepoints and characters etc.
 
@Ell I don't know enough for that, because it's all very complicated. I'd start by studying the unicode libraries available, and learn from them before I started
 
user784668
6:56 PM
@MooingDuck And I agreed with that already, didn't I?
 
@sbi Team Lead
 
@Ell a glyph is a "thing" on the screen. (letter, symbols, space, etc)
 
Ell
yeah
 
@Ell a character is a byte of data. A codepoint is an instruction as to what to draw? (99% of codepoints are letters)
 
if I call exceptions(istream::eofbit) on an ifstream, is that equivalent to setting the ifstream::eofbit flag, or are the istream flags separate from the ifstream flags?
 
6:58 PM
@robjb exceptions doesn't set any bits, it means "if this bit it set in the future, throw an exception"
 
Ell
@MooingDuck so a character is synonymous to a byte?
So codepoints are to do with rendering?
 
@Ell yes
 
@Ell sizeof(char) == 1
 
@Ell as far as I've determined, yes
 
Always
Although the definition of a byte can vary by architecture ;)
 
6:59 PM
@Ell so where does wchar_t fit in? Nowhere!
 
Ell
@MooingDuck okay, thank you!
and yeah :S
 
@MooingDuck Let me rephrase. I know it doesn't set flags, but it causes the setting of those flags to raise an exception. Are the istream and ifstream flags treated separately?
 
Ell
@MooingDuck what does it mean for a programme to have unicode support? Just that it can read/write to files in languages that need to use unicode?
 
@robjb I think they're the same bits, so one call does both
 

« first day (489 days earlier)      last day (4458 days later) »