« first day (13 days earlier)      last day (4929 days later) » 
00:00 - 18:0018:00 - 00:00

6:01 PM
no, I don't think I've had a need to get that low level yet. I guess it would aid my understanding of how computers work though
other languages I use are javascript sql* haskell php ruby c# objective-c
 
yea it has increased mine, learning it
oh I tried to learn Haskell onced
but my lambda calculus sucks
lol
 
heh
It does have a steep learning curve it seems
I've made a couple of tools using it for work, but they are simple things like command line apps
 
yea, I found some vids on channel 9 that went over it from beginning
but the math got me lost... although I have learned more of this math now, maybe I should try again sometime
oh ok
you into networking too?
 
my main issues with haskell are that making anything complex for windows with haskell is much harder than targeting linux, and that the quality of the libraries on hackage aren't all that good.
 
since your name contains 'Cisco'
and IP
 
6:05 PM
oh hehe
 
oh yea, I prefer linux over win anyways, but unfortunatly only use win at work...
 
I'm into IP telephony, one of the things I do at work is make IP telephony products.
 
oh cool
like VOIP type stuff
 
yeah.
 
sounds like fun :)
 
6:09 PM
it can be :)
 
so you mostly do embedded programming then?
 
no, I mostly make windows software targeted at large businesses, for example we have a product called CAS that let's an operator operate their phone from their computer, retrieve customer details automatically, record their calls and other stuff
 
oh cool :)
 
provide call stats, allows users to retrieve calls from a queue if it's being used in a call centre etc etc. I have to do a presentation of it next month to the american division of our company who is starting to use it
I r looking forward to the trip, not especially the presentation :p
 
Hey
friend, anybody can help me... I need find information abou EMV library?
 
6:23 PM
@PhE What does EMV stand for?
 
De ja vu, i was in SO tavern and Ph.E asked the same question. EMV stands for " Europay, MasterCard and VISA" i assume
 
@RafeKettler library operations with chip cards, such as banks
 
Oh okay
 
@Anton yes, right. I posted there too. After all, different communities, but related.
 
No problem. If I needed an answer I'd look everywhere I could too.
 
6:28 PM
You're most likely to get an answer from your question on SO, I would think.
lost more people there than in the chatrooms.
*lots
especially since it's a very specialized question.
 
While i was trying to write my message in correct english, @StephenCanon wrote the same thing :)
 
Yeah, I'd give it a day or so and you should get some answers
 
I'm looking on google, but it is tricky to find. I not found any good material in Brazil, and hard to find this out too.
I'm looking on google, but it is tricky to find. I not found any good material in Brazil, and hard to find this out too.
 
Yeah, my googling doesn't turn up much either. Can you just use an off-the-shelf solution rather than make your own?
 
@PhE what exactly do you want to do with emv?
 
6:36 PM
is it me... is not fairly obvious that if you are using a 3D object, with something like DirectX, that you will also store an xyz value with that object so that you know how much to translate by to get your object drawn to the right position
 
@Anton I imagine he has to do some type of commerce or point of sale tech
 
@RafeKettler: I think he's looking for help with existing libraries.
 
We need to use the library on a new project. It is my responsibility to gather information about it and generate a report.
 
@PhE and they didn't tell you where to find it? It seems rather elusive
 
We need to use the library on a new project. It is my responsibility to gather information about it and generate a report.
 
6:37 PM
What's with Ph.E's echo?
 
@PhE ok, lets start with smartcon.com.br/cms2/content/view/24/65/lang,en is it what you need?
 
@StephenCanon yes, right!
 
You should request information about EMV through this page, then:
 
My English is bad, so sorry for the mistakes.
 
No problem, I understand you fine
 
6:44 PM
@RafeKettler I'm reading the text. Thanks
@Anton I'm reading the text.
@Anton I'm reading the text. Thanks
 
@PhE by the way, you can edit your messages instead of posting the fixed version.
 
@Anton edit the message in the chat, here?
 
@PhE yeap. mouseover your message, u'll see a down arrow on the left. click on it and you will see an edit link.
 
7:02 PM
as long as the message isn't too old =)
 
@StephenCanon has anyone checked how old it can be to still have the ability to edit it?
 
@Anton Understood. Thanks!!
 
@PhE ur welcome.
 
Vector3D **vertices;
vertices = new Vector3D*[10];
vertices[0] = new Vector3D(3.0f, 0.0f, 0.0f);
 
@Anton I believe that it's 5 min, same as comments on SO. But I'm not actually certain.
 
7:06 PM
perfectly valid yes?
and I would access these in say a for loop in the form verticies[i]->someFunc();
 
@StephenCanon do not use it much, I'm still noob.
 
looks valid to me. but if it's 1d why not just Vector3D * vertices; vertices = new Vector3D[10]
 
This chat making life more easy. What was good, just got better
 
@CiscoIPPhone because I want to use differing constructors on each of them, I don't want just the default constructor... though I suppose I could just call an update function any ways... leaving the default constructor being called... I think I have come up with a crazy solution to a problem haven't I
 
sbi
@Anton The up arrow will edit your last message. (Roger told me that today.)
Hi, BTW.
 
7:20 PM
@Anton: "You have 120 seconds to edit your messages. All edited messages have a small edit indicator."
so you get 2 minutes to edit.
 
3
A: Setting up a FAQ for the C++ tag

Steve TownsendOne thing that I've noticed is that "FAQ" are often answered again, rather than closed as duplicates. I think the reputation system (unfortunately) encourages this. It would be preferable imo if the system could somehow encourage exact dups to be upvoted rather than directly rewarding the pro...

7
A: Setting up a FAQ for the C++ tag

GManIdeas for C++-FAQ Questions might be: How do I learn C++? What if I know another language? What resources should I use? Close to my heart. State my profile in a far nicer manner, explaining rationale possible "meta" tips about learning (how to avoid thinking in other languages, why not to, how...

0
A: Setting up a FAQ for the C++ tag

Mads ElvheimI don't oppose the idea for a FAQ, but I'm pessimistic and don't really think it will make a major difference. The target group are those who rather start a new question rather than doing proper searching at all. And I don't mean just the Stack Overflow search, but also literature, web search eng...

0
A: Setting up a FAQ for the C++ tag

wafflesThe C++ tag wiki is really basic at the bare minimum 10 or so really common questions that are hard to search should be linked from there. Also, Link furiously to the canonical duplicate questions you find, this will improve the FAQ. If we had a huge red sign on the site and people will still o...

1
A: Setting up a FAQ for the C++ tag

DefaultI have been a member for less than a year here on stackoverflow so I haven't seen the issues that are described here to it's full extent. But I'll make the assumption that the real issue here (that makes people leave the StackOverflow community) is the repetitive tasks of, either linking to dupli...

 
sbi
Um, I'm sorry for that mess. I just added a feed to this room for that question on meta which was sparked here. Unfortunately, this will cause all the old answeres to be posted, too.
(@Roger might now regret his decision...)
 
I'm sure we'll manage somehow =)
at least it's on-topic spam!
 
@sbi, yeah, we'll manage. at least because i didnt understand a thing of what just've happened :D
 
@StephenCanon funny concept
 
sbi
7:31 PM
@Anton Room owners can add feeds to rooms. Feeds will show up either as a small overlay atop of the page or as postings by the "Feeds" bot user. This room already had a feed for questions tagged C++ on SO. I have now added another one.
@Anton: If you want to understand why I added this feed, look at this question on meta:
33
Q: Setting up a FAQ for the C++ tag

sbiA while ago Neil Butterworth, one of the most highly reputed people in the C++ tag (he has given so many good answers, that in the two months since he left, his defunct account has amassed >2000 rep from old answers), left here, obviously in frustration about Stackoverflow. I have since heard a f...

 
8:00 PM
@RogerPate Ah there you are... thanks for the blog compliment, I'm following you on Twitter now. :) Reason for infrequent blogging is I shifted away from programming a while ago and moved to LA for film/media/graphicdesign. But I have been getting back into it with a few projects and thoughts. Now I'm moving to Hawaii to surf and drink umbrella drinks... and I may get back into software professionally to the extent it may be done in that location.
C++ is important and used to be my favorite. But I have found myself aligned with the movement to manage and reduce complexity, so domain specific languages and "alternative" tools have been the focus of my investigation lately.
 
poor neil :(
 
sbi
@HostileFork "...to the extent it may be done in that location." You mean between surf and umbrella drinks there won't be much time for programming? :)
 
@sbi Well I'll be in Maui and it's not exactly a hotbed of technology startups or anything. A few people are doing interesting things. But generally I'd have to work remote on anything that I'd actually want to do.
I have been sort of considering using my EE degree and generalist programming savvy to get in my foot in the door in some non-US job... I'd like to live in another country for a while.
Having never tried that, I don't know what it would entail.
Has anyone managed to get in touch with Neil?
(Just reading that he took off.)
 
sbi
8:25 PM
@HostileFork Living in another country would be good for anyone. I highly recommend it. Broadens your perspective.
@HostileFork Neil had been a long-time regular in comp.lang.c++.moderated before he came to SO, and is said (I didn't know that) to have left there more than once. I'm not moaning that much that Neil left (he could be quite rude at times, although his contributions were on a high technical level), but fear that other highly reputed users might also leave for similar reasons. Some of them have expressed similar resentments.
 
@sbi Is that a gorilla?
 
sbi
Hi James!
No, it's me.
(You're a star, BTW.)
Do you have an alert set that triggers when Neil is mentioned? Can't believe it's accidental, you showing up right now... :)
 
Ha ha. Yeah, I've been a star for a long time. Complements to Bungie for the emblem :-)
 
sbi
Long-time star, eh?
 
Usually a falling star, but...
 
sbi
8:37 PM
How's your new job? Apparently you still have time to chat, so I suppose it's fine?
 
It's awesome, thanks. I'm still in the "wtf am I supposed to be doing?" phase and the "this C# looks nice, but things were so much easier in C++!" phase, but that will pass.
 
sbi
Oh, that C# phase can take a very long time. I've been in it for 1.5 years now, and boy do I miss the raw power of C++ templates!
But I recently discovered that I'm starting to like LINQ, so not all is lost.
@JamesMcNellis But I'm very old-school anyway. For example, I dislike web stuff passionately. Mhmm. But then I dislike database stuff even more, and that's definitely not old-school thinking.
I guess I'm just weird.
 
Yeah, up until a month ago I'd probably have said, "well, yeah, C# has generics, I figure they're just like templates." Yeah... not so much...
 
sbi
No, nothing's like C++ templates. That much I learned.
 
My biggest "complaint" is with the nonuniform resource management. using just feels clumsy compared to RAII in C++.
@sbi I worked on a few big hobby web projects. I enjoyed it a lot for a couple of years, but I could never work on web projects long-term; it's too repetitive and just generally uninteresting to me.
 
sbi
8:44 PM
Yeah, GC takes all the worries about memory management, but leaves you out in the cold with all the other resources. That sucks.
Maybe my problems with web projects is that, in essence, they're just GUIs for databases. And that's two things I hate. :)
Although I have done a bit of GUI stuff, >10 years ago, and did enjoy it back then.
That was BCB, though. Really long ago.
 
I just like working on different things; after a couple of years I get really bored and need something completely different.
 
sbi
Well, I had been working with C++ for about 15 years and never got bored. But then, I wasn't only hacking away using it, I also taught. And just when things threaten to become really interesting again (lambdas, concurrency etc.), I get stuck with C#... Life's a bitch.
 
I never really liked C++ until I started reading Stack Overflow and getting to understand it more. I shudder to think of the terrible code I wrote for the first five years I was developing in C++.
C# has some nice syntax things though, and the async methods that were announced yesterday look really quite useful. I think the C# lambda syntax is cleaner than the C++ lambdas, but from what I understand, C# lambdas are missing the flexibility of C++ lambdas (I don't actually know if that's true).
@sbi Did you teach college classes or professional development classes or...
 
sbi
9:01 PM
I started out with reading TCPL(1st ed!), ARM, E&D, Coplien's idioms book, Lippmann Inside the Object Model etc., so I got a good head start. But C++ is so complex, it still took me years to start to write good code.
@JamesMcNellis I taught C++ to students who had one year of Java exposure (poisoned, the lot of them) at what they translate as "University of Applied Science". I think it's more alike to a technical collage, though. I taught at two different ones here in Berlin.
 
Very cool.
 
sbi
I also taught the apprentices at one company I was for almost a decade. Over all, I taught four generations of them. Some of them later became my fellow-workers.
 
ok... I want to interlace to arrays... stupid?
 
if you need to do it, do it :P
 
sbi
@JamesMcNellis I hadn't had the time to play with C++1x (although I have VS10 installed on this machine), so I don't know much about C++ lambda. (Except for what I read on SO and a C++1x seminar by Scott Meyers.)
What's different between C# lambdas and the C++ ones?
 
9:11 PM
C++ lambda that takes a string argument and just returns it: `[](const std::string& s) { return s; }`
C# lambda that takes an argument and just returns it: `s => s`
:'( Backticks fail.
 
Haskell (\ s -> s)
With C++ ones you can choose which variables the lambda can reference or copy, can you do that with C#?
 
My understanding though is that there are some restrictions on what you can do with C# lambdas; I honestly don't know what they are.
 
sbi
I think backticks work for me. Yep, they do.
 
@CiscoIPPhone No, because the CTS distinguishes between value and reference types; in C++, all objects are of value types and you can have a reference to any object. [that's totally imprecise, but I'm not a type theorist, I'm a programmer :-)]
 
sbi
@JamesMcNellis Yes, I immediately saw what you meant with "cleaner syntax". I was asking about the flexibility you miss in C#.
 
9:15 PM
@JamesMcNellis I get the gist :)
 
sbi
CTS?
 
@sbi Common Type System, the type system used by .NET
 
sbi
Ah, that one. Didn't know the acronym. Thanks.
 
@sbi I don't miss the flexibility; I think the C# lambdas are missing the flexibility of C++ lambdas; I don't know if that's true: I just think I've read that a few times.
 
sbi
Too bad, I'd be very interested in a comparison.
 
9:20 PM
can I use sizeof(float) to move a pointer one float forward (as it where)
 
@thecoshman What kind of pointer is it?
 
the best kind, void :P
 
@thecoshma convert it to float* move and then convert back :D
 
oook.... so I say `float* tempfloatptr = (float*) myvoirdptr; tempfloatptr++; myvoidptr = (void*) tempfloatptr;
 
well i dont see any problems here.. you're not working with void pointer's actual value, so there must be no problem
The thing is.. i never did such thing and cant say if it will work or not :)
 
9:30 PM
@Anton LOL! I don't know why, but I always seem to find a the maddest ways of doing things, and not realise just how mad they really are
 
@thecoshman well its good when there's no other way. but when you miss a simple and beautiful way... its even worse than you havent found a way at all.
 
@Anton yer...
 
Googled "yer" and now i know that 1 Yemeni rial = 0.004662 U.S. dollars. What a useful information.
 
right... think I need to think things here, who's wise to the world of DirectX?
 
sbi
@thecoshman Librarian, is that you?
 
9:36 PM
@sbi say what? <straight face>I do not go by the alias Librarian</straight face>
 
sbi
Ook?
 
I do DirectX
 
¬_¬ shifty eyes
 
I guess your void is coming from a buffer lock?
 
@CiscoIPPhone you know the old vertex buffers and FVF business...
 
9:37 PM
yep
 
sbi
The Unseen University (UU) is a school of wizardry in Terry Pratchett's Discworld series of fantasy novels. Located in the city of Ankh-Morpork, the UU is staffed by a faculty composed of mostly indolent and inept old wizards. The university's name is a pun on the Invisible College. The exploits of the head wizards of the Unseen University are one of the main plot threads in the longrunning fantasy series, and have played a central role in 13 novels to date, as well as the three supplementary Science of Discworld novels and the short story, A Collegiate Casting-Out of Devilish Devices...
 
int fvf = D3DFVF_COLOR | blah and stuff
 
sbi
Crap, that link goes down further into the page. Next try: en.wikipedia.org/wiki/Ook_language_%28Discworld%29#Librarian
 
@CiscoIPPhone indeed. I am trying to make a class that is able to build model data of any style and then copy that to buggers and what nots
 
sbi
Anyway, the question, how did you end up having a void* anyway? Except for C APIs, I can't remember when I had one the last time.
 
9:40 PM
DirectX is c compatible I think.
it talks to GPU hardware
 
I want to be able to say, make a new instance of my class, and set it into and FVF mode, and fill in the vertex data of that type. but I can't my head around how to store an array of the vertex structs, as I need to make this struct different depending on what FVF mode I set it to
@sbi You use it transfer graphics data to the graphics card, you get a void* and use memcpy to block transfer your array from sysmem to gmem
 
sbi
You cannot add to a void*, because it doesn't point to an object of a specific type. No pointer arithmetic with void*. You could add sizeof(float) to a unsigned char*. But once you're in casting land, better cast right to float*, as Anton said.
 
You could store a pointer to float thecoshman, and then cast it to your specific struct type depending on your fvf
not very elegant I know
 
@sbi but I need to transfer data of multiple types... so I could just keep recasting my type back and forth. I basically need to interlace arrays of different data types... If I could some how work out how to make struct wh'os data fields are determined at run time...
@CiscoIPPhone but how can I make a struct to match my FVF at run time
 
well where does the FVF come from?
When I used directx I think I gave my structs a static fvf() member that returned their fvf
I mean there's no way to actually define a custom struct at runtime
 
sbi
9:46 PM
@thecoshman What's an "interlace array"? (I'm blind when it comes to all that shiny graphics stuff.)
 
@CiscoIPPhone well, when you are copying the vertex data, you need to say what your FVF is, this is basically a number that dicates what components your vector has in it
@sbi I have two (or more) arrays, and I want to make them one array... sort of looking like a[0]b[0], a[1]b[1], a[2]b[2] etc.
 
sbi
And the elements are of different types??
 
@CiscoIPPhone What about useing the FVF to determine which struct type to make my array of, to then fill with data, to then memcpy to Vram... I could soem how define EVERY combination of structs..
@sbi well, A could be three floats or four, then b might be a unsigned long. In theory I could know every combination I could use, and the value of FVF would dictate this
 
if all you are doing is loading data from disk to GPU*, you don't need a custom struct.
A custom struct is handy for when you want to modify vertex data
 
sbi
@thecoshman How do you determine the types? At run-time or at compile-time?
 
9:51 PM
what if I made basic structs that contatin the basic components, and use multiply inheritance to build them into the composant struct that I need to store my vertex data (vertex data possibly contain just xyz but also poissbly colour info, texture info)
 
sbi
Wait, you already said at run-time...
 
@sbi well, at the moment, I am trying to make a function to do a prebuilt object, so I know what components I want and what the values are, and how many vertexs there are
 
should the function be able to work on objects with different fvfs?
 
sbi
If it is at compile-time, use templates to fit in the types. Put that casting back and forth into some function template and you don't have to see it again. (It's all a compiler front-end issue anyway, so no performance lost on that.)
If it's at run-time then cast your `void*` into an `unsigned char*`. Per definition, `sizeof(unsigned char)` is one, so you can add `sizeof(float)` to it and land right behind the `float` it refers to.
 
@CiscoIPPhone idealy yes, I want to be able to use this class, set what FVF it is to use, then pass in vertex data, then when I am done, tell it to copy to the graphics card (thus needing that data in one array where each index is all the data bout one vertex) and later call draw functions on my model
 
9:57 PM
thecoshman: I think this would be a good question on gamedev.stackexchange.
I've got an idea for a solution let me think about it.
 
templates have to be done compile time don't they...
 
sbi
@thecoshman The parameters have to be known at compile-time, yes.
 
@sbi what making an array of a type that is determined the by the value of a variable?
 
sbi
Err, what?
 
eg, user enters something, if it a letter, make an array of chars and let everything the enter after be stored as a chars. if though they entered a number, make an array of ints and then let them enter the rest numbers into the array
 
sbi
10:03 PM
@thecoshman That won't work, except when you have a fixed set of types and switch over the types into the requested branch of code.
 
@sbi I do technically have a fixed number of types, but they will not be of the same size
 
sbi
Something like
switch(get_input_type(input)) {
case float_tag: do_it<float>(input);
case char_tag: do_it<char>(input);
default: ...
}
 
yes
but more
switch(typeIdentifierNumber)
case 1: datastore = vector<justxyz>;
case 2: datastore = vector<xyzandcolour>;
case 3: datastore = vector<xyzandcolourand textureUV>;
default:
}
 
sbi
std::vector<> can always only house a single one type. If you need to keep more of them, make it a std::vector<unsigned char> and wrap the usage in a few helper (member) functions that do all the type casting etc.
Something like this:
template<typename T>
void add(std::vector<unsigned char>&v, T obj)
{
unsigned char buffer[sizeof(obj)];
// copy obj into buffer
// append buffer to v
}
 
thecoshman: this is an idea I had (pretty rough idea) check it out: codepad.org/93NqZVfd
 
10:09 PM
@sbi well, justxyz would be a define dstruct, like xyzandcolour would be as well
@CiscoIPPhone I see... I think I know what you are doing there... clever
 
oh there's a mistake where I set the x,y,z - it's all the same index.
would probably be best to use a xyz struct there, perhaps have a struct for each separate fvf component
like a struct for texture coordiantes, a struct for color and so on
 
sbi
The classic Mac had a screen resolution of 512x342, high res icons in OS X have a resolution of 512x512. Just think about that for a minute.
 
so instead of modelData[i*modelData.stride+getOffset(D3DFVF_POSITION)]=1.0f; // x position
XYZStruct xyz=(XYZStruct*) &modelData[i*modelData.stride+getOffset(D3DFVF_POSITION)];
 
yer, Im thinking that making a set of structs, each of which defines one component that a FVF could use. What about inheriting them together to make to composite FVF structure I want
 
I dont know about that, they need to be contiguous in memory and you need to define the order
 
10:17 PM
@CiscoIPPhone and just multiple inheritance would not give you this will it
 
@sbi: nice quote.
 
sbi
Well, anyway, I got to go to bed now. It's already Saturday here, and the kids will need attention tomorrow morning.
See ya.
 
@CiscoIPPhone taking you example as a starting point for this one... you set the FVF of the struct instance, and can then pass in the components for the single vertex, and when it provides a size of function that works out how big it should be, and some how make a dump value function that returns a block of data just big enough to hold the value it has actually using
 
10:32 PM
In my example I just assume the float * is big enough already, but yeah you could add a function to allocate memory
but it would have to allocate memory for the whole vertex array if you intend on sending it to gpu. so something like float * allocate(int fvf, int vertexCount);
 
my heads hurts :(
 
It might be overkill
 
right... taking it back to first basics... I have some arrays... I want to make a new array, taking the first element from some of the first arrays... I can then transfer composite array in one go
so I have an array of xyz data an array of texUV data an array of rgb data, and want to be able to stick the elements of say the xyz and rgb to gether... so that the nth element of the xyz array is with the nth element of the rgb array
 
@thecoshman sounds like combinatronics to me
 
@Tony combinatronics... did you just make that up?
@Tony and how can I do it :P
 
10:42 PM
combinatronics is a branch of maths
Combinatorics is a branch of mathematics concerning the study of finite or countable discrete structures. Aspects of combinatorics include counting the structures of a given kind and size (enumerative combinatorics), deciding when certain criteria can be met, and constructing and analyzing objects meeting the criteria (as in combinatorial designs and matroid theory), finding "largest", "smallest", or "optimal" objects (extremal combinatorics and combinatorial optimization), and studying combinatorial structures arising in an algebraic context, or applying algebraic techniques to combinatori...
 
hmmm... possibly, except I know what component arrays I want to use to stitch together into a final array
 
Enumerative combinatorics would probably be the area to look into
but I'm no mathematician, so you'd have to research a little bit
hope it may be of help
permutations, combinations etc....
this may sound incredibly dumb, but what about applying some recursion to this?
 
Ill ask it here anyway. Can someone suggest me a good class for decision tree implementation with the ability to prune trees? Waffles just dont have it.
 
in what way? I am up for more or less any ideas right now, i've got nothing at all really... other then arrsing around type casting points all the time
 
and those arrays are totally different types I assume right?
 
10:50 PM
@Tony yes, some are of 3floats, some are of unsigned long
 
and how do you want to combine them? I mean are you adding values in combining or are you just placing them in some key/value map?
 
I"ll just say what he's trying to do
he has struct type A and type B
he's got an array of A's, and an array of B's
 
@CiscoIPPhone yer please, I assume you know what am trying to do... better then I do know :P
 
he wants an array that's ABABABABAB that's the above arrays combined
 
lol
 
10:52 PM
sorry
 
@CiscoIPPhone yer, that the one!
 
and a pointer to A and a pointer to B?
 
no it's cool dude, youve really help me narrow down what I am trying to do
 
are these structs in any way related?
 
well, I want an array where the C[n] is A[n] exactly followed by B[n]
 
10:54 PM
@thecoshman: do you require that there be no padding between the As and Bs?
 
@StephenCanon yes, I require NO padding
 
so contiguous in memory...
 
if you require no padding, I don't think you can do it in a portable way other than using memcpy.
and just slamming the bytes of A and B into place continguously
 
I can fill up two arrays, one of xyz data, the other of rgb data. and combine them into an array of xyzrgb data (where in this case x y z r g and b are all floats)
 
right, if you know something about your structs, then you can avoid memcpy.
 
10:56 PM
intersect A and B
 
thinking I might get a SO question running for this, sounds very suitable
 
specifically, you need to know that the alignment requirements of your structs don't exceed the alignment guarantees of the component types.
 
set theory
 
but that's not going to be portable, in general.
 
or not...
 
10:58 PM
(I don't know if portability actually matters for you or not)
 
@StephenCanon what do you mean by portable?
 
I mean that the alignment requirements of structs and basic types varies from platform to platform. So solutions that work on one platform might not work on another.
 
using DirectX so, yer, just needs to run on win
 
@StephenCanon oh I get it
 
In that case, you should be able to declare something like struct C { struct A; struct B; }; with some compiler-specific attribute to indicate that the elements of the struct have no padding.
then make an array of `struct C`s and copy the data in in the obvious fashion.
 
11:00 PM
the other thing is there are a few different components that I want to be combining. I do have a variable that dictates what components I am going to combine
 
if you want a fully general solution, I would probably just use memcpy, personally.
it will work, and it's easy.
you can always tune the performance of specific cases later if you need to.
 
I just don't know how to implement this though.
 
oh, ok.
 
be back later poof!
 
@thecoshman: I would do something like this:
const size_t packedElementSize = sizeof(struct A) + sizeof(struct B);
char *arrayOfPackedElements = malloc(numberOfElements*packedElementSize);
char *nextElementToWrite = arrayOfPackedElements;

for (int i=0; i<numberOfElements; ++i) {
memcpy(nextElementToWrite, arrayOfAs[i], sizeof(struct A));
nextElementToWrite += sizeof(struct A);
memcpy(nextElementToWrite, arrayOfBs[i], sizeof(struct B));
nextElementToWrite += sizeof(struct B);
}
not the prettiest solution, (and very much C instead of C++, so you'll need to tweak it some)
but it should work.
 
11:07 PM
one thing though, I also have struct C and struct D that I could add into thie packedElement array, but sometimes I may not want to add in struct B
 
pack that into a function that takes the size of the structs as an argument, as well as the arrays.
and just call the function twice or more to interleave additional arrays.
it's not efficient, but it will work.
 
you mean make a function that takes two arrays and fits the elements from the second after the each element of the first, then if I want to merge struct A then C then D, I call
Merge(arrayofA, arrayofC);
Merge(arrayofA, arrayofD); // arrayofA is already arrayofAB
 
essentially, yes.
if the arrays are huge and this is performance critical, then it's suboptimal.
but make it work first, then worry about if it's fast or not.
it's an easy way to get it to work.
 
ok wow! mad science stuff. luckily, I am talk arrays of like 50 elements tops
 
yeah, for ~50 elements, performance is probably a total non-issue.
 
11:14 PM
now this function... its going to need to accept two *void, one for each array? as well as a size of element in array A and size of element in array B, so four parramaters in total? possible passing the number of elements in the two arrays I want to merge together...?
 
right, probably 5 parameters
just as you describe
 
I see one problem though, the sizeof includes padding... is there a way I can get the amount of space needed with out padding
 
11:31 PM
oid Utils::MergeArrays(char *ArrayA, char *ArrayB, int elementSizeA, int elementSizeB, int numElements)
{
char *packedElements = (char*)malloc(numElements* (elementSizeA, elementSizeB));
char *nextElement = packedElements;
for(int i = 0; i < numElements; ++i)
{
memcpy(nextElement, (void*)ArrayA[i], elementSizeA);
nextElement += elementSizeA;
memcpy(nextElement, (void*)ArrayB[i], elementSizeB);
nextElement += elementSizeB;
}
}
obviusly I need to actaully return this merged array some how, but this should do the trick yer?
 
11:55 PM
0
Q: Trying to make an array of DirectX vertex with out knowing until run time what type they will be

thecoshmanBit of background for those who don't know DirectX. A vertex is not just an XYZ position, it can have other data in it as well. DirectX uses a system known as Flexible Vertex Format, FVF, to let you define what format you want your vertexs to be in. You define these by passing a number to DirectX...

ok guys, I have posted question on SO. Ive got to sleep about an hour ago :P Please just through Ideas at it
night all
 
00:00 - 18:0018:00 - 00:00

« first day (13 days earlier)      last day (4929 days later) »