« first day (1487 days earlier)      last day (3678 days later) » 

Ell
Ell
00:07
I want to extend a template class
But for that extension to be implicitly applied I guess
I guess I want class template specialization where I don't have to reimplement everything in the specialized class again
Not sure if its possible
I want class template specialization where it's not class template specialization
Ell
Ell
I want retroactive I inheritance :P
If foo returns bar<int>
Meh.
I want to extend a class after the fact
that sounds complicated
have you considered passing void*s around like crazy?
okay, I'll show myself out now
I have to wake up earlier tomorrow anyway :(
gotta go watch my classmates make more diagrams and argue about how many controllers and views we need
Ell
Ell
Inheritance would kinda do it
I'm sure there's someway I can figure it out
But I need the functions that return foo<T>
To return the extended versions when you extend foo<T>
So plain inheritance doesn't work
00:30
Your design probably sucks
Good morning.
Stack Overflow HTTPS seems to be broken.
I'm shocked
Ell
Ell
I don't think my design is bad
I'm just designing for interop
@CatPlusPlus Just out of curiosity, why is the tag not in the list for this room?
I don't know I don't care about those tags
00:36
because it's a crappy tag
s/those tags/c++/
That too
0
Q: Fantasy Football Project C++

Dev I was assigned to a group of really good programmers for a class project in my CIS class. I don't have much experience with C++, but the teacher put me in the group so I'm stuck. They wanted me to write a module of a fantasy football pick program, specifically the File Input/Output. They wanted m...

lol
They call it CIS now?
user1646075
@MarkGarcia sexist bastards.
00:38
@MarkGarcia Who is "they"?
@aclarke oh lol
user1646075
@Columbo The establishment, man
@Columbo uni guys
user1646075
the white male heirarchy.
@Columbo Good thing the teacher specifically asked for a vector.
00:41
lol an answer with 0 votes
time to delete it
@Columbo lol, there's 4 questions, 3 of them are closed.
@Mysticial Lol, didn't even notice
Clicked on the tag and saw a couple of questions with accepted answers, immediately closed the tab
@MarkGarcia It has been called CIS in a lot of places for a long time.
Computer Information System.
@Borgleader That's thinking outside of the box
00:55
eh, i like kevin bolk's drawings, he really nails the facial expressions
user1646075
If box is slang for vagina, does thinking outside the box mean anal?
i dont even
12
Q: Unusual using of .h file in C

artsinDuring reading article about filtering, I've found some strange using of .h file - use it for filling array of coefficients: #define N 100 // filter order float h[N] = { #include “f1.h” }; //insert coefficients of filter float x[N]; float y[N]; short my_FIR(short sample_data) { float result =...

^^ wat
Ell
Ell
@aclarke anal is the litter box
@Mysticial Have you never really seen this?
user1646075
00:59
Don't tell my cat that.
user1646075
@Rapptz No I haven't.
lol
It's obvious why it works, but I've never seen code that actually did it.
it's not that rare
user1646075
01:00
@Mysticial that question came from someone used to more orderly languages with "use" or "import" statements.
@Mysticial SFML has/had a .h file containing a list of vertices for its default font (Arial).
@Mysticial Look at ogonek, robot does this. Basically he has some python code that converts some unicode data into an array literal just like this and includes the generated file in a cpp somewhere.
I find this more hacky than doing a straight include
3
A: Unusual using of .h file in C

barak manosAs already explained in previous answers, it is not normal practice but it's a valid one. Here is an alternative solution: File f1.h: #ifndef F1_H #define F1_H #define F1_ARRAY \ { \ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, \ 10,11,12,13,14,15,...

@Rapptz That I've done before.
You're terrible
:v
01:02
But now I just use real constants.
Example being the ones you fixed for me last week.
user1646075
A true master of generation also generates the infrastructure around the constants.
@rightføld I was just gonna ask
Ell
Ell
Man I'm stuck. I feel like what I want should be possible
user1646075
@Ell you're kinda talking co-variant return types, right?
Ell
Ell
Why can't the compiler just wait patiently until I define the type to inherit from :P
@aclarke I don't know to be honest :P
I want to extend a class after the fact
01:12
After what fact
Ell
Ell
After I've defined it
That's always when you extend a class
user1646075
SSCE please - showing the 'wanna do this'
Ell
Ell
Kk. Let me get out of bed
user1646075
@Ell oh, don't make an effort on our account.
user1646075
01:13
two hands on the keyboard would probably make coding easier too
Ell
Ell
on it's way now
idk, kind of showcases what I want :S
@aclarke in order to prevent XY, my goal is to allow easy interop with a Ref<T> class which represents a strongly typed jvm reference to an object on the jvm
your example is weird
but maybe you should try using RTTI and something similar to the Entity Component System maybe
Ell
Ell
So I want to be able to "extend" Refs tagged with java::lang::String and add a string conversion operator for example
01:29
allow Ref to dynamically add tags
like ref.add<tag>(args...)
then you can get<tag> maybe
Meh just unbox explicitly
user1646075
I defer to the master Temp lat ars. But now they see your goal...
You'll have to downcast one way or another
Which is always explicit
essentially yeah
Ell
Ell
@CatPlusPlus true
01:39
HOWWWWWWWWWWWWWWWWWWWWW...
does one create a cancel-able thread in WINAPI?
Carefully
Ugh I always forget to insert pv to long-running pipe operations
Ell
Ell
could do this or something SFINAE but better coliru.stacked-crooked.com/a/d527ff5d506f691c
and have a make_ref
oh wait.
I'm dumb
idk
I'm gonna go to bed now anyway
Wait I don't even need the explicit specialised thing
Have you guys tried to generate a mesh from a cube of data? Anybody know if this can be done in realtime?
Ell
Ell
A cube of data?
01:57
Hello m8(s)
How are you doin'?
Ell
Ell
My head is killing
I'm dehydrated
Get some Hijklmno
get it?
That's not a very difficult problem to deal with unless you're in a middle of a desert or something
H2O
?
H to O == H2O == Water
no?
get it?
So apparently if you replace enough of your liquid with deuterium you will die
Also your absorption peak will change.
02:02
I'm shocked
I do physics and a famous research group demonstrated a 3 photon microscopy technique. To avoid the absorption peak of normal water they had to replace a significant amount of fluid in a rat's brain with deuterium.
This is why Nature should be read carefully.
Heavy water, formally called deuterium oxide (2H 2O or D 2O), is a form of water that contains a larger than normal amount of the hydrogen isotope deuterium, (also known as heavy hydrogen, which can be symbolized as 2H or D) rather than the common hydrogen-1 isotope (called protium, symbolized as 1H) that makes up most of the hydrogen in normal water. == Explanation == Some or most of the hydrogen atoms in heavy water contain a neutron, making those heavy water hydrogen atoms about twice as heavy as normal hydrogen. However, the weight of the heavy water molecule as a whole is not substantially...
its what fat people drink!
Do you guys know why we get cancer and spiders or other exocreatures don't?
Its because we, like all things that get cancer, retain water in our cells
Interesting to note is that a lot of anti-cancer treatments include basic diets that consist of minerals which break down into hydroxides.
@Alexandru Thats kinda bullshit. Foremost, we can trivially cause cells to grow and lumps have been observed in invertebrates, in trees we call this cancer. You don't see metastasis because invertebrates don't have mechanisms that transport cells.
Significant progress in cancer regulatory pathways has been studied in Drosophilia...
02:19
boss is arguing that RAII makes debugging significantly harder, since } can trigger hundreds of lines of (destructor) code
Ell
Ell
If you use RAII you'll have yo be debugging much less often
I think that's only a problem if you have bugs in your destructors.
If you're doing business code in the destructor.
then you've got bigger problems.
But our code base was not written with the mindset of "my destructor should never ever blow up in any way"
02:21
Much bigger.
So for us, he makes a certain amount of sense.
(we're arguing about this)
If you're doing RAII right then you should never worry about lifetimes.
@Mikhail Yes, invertebrates have rarely observed this because of a genetic precondition of an overgrowth of stem cells where cancer is detected; stem cells lead to water retention in those areas.
Of course you'll worry about lifetimes
Nor debugging because of lifetime issues.
02:24
Local lifetime is trivial
Because RAII is meant to solve lifetime problems.
Tumors are a lifeform within a lifeform, a virus. They survive and die by the same rules we do.
@MarkGarcia Hahaha, good you edited it. "Nor debugging" was definitely false.
@CatPlusPlus Rule of zero.
RAII is meant to solve deterministic resource management problem
Lifetimes are more complicated
cf any non-trivial codebase that uses shared_ptr
Rule of zero is something else entirely
Or locals vs callbacks
Or thunks
02:29
Of course, this isn't exactly RAII. coliru.stacked-crooked.com/a/403a00183ae586f5
@Mysticial Hey
@Mysticial Fancy seeing you here. We figured out kernel mode drivers to get Intel core frequency eh? :)
@caps That's just dumb in every way
What I mean is that when you construct a class (and thus its destructor) in an RAII fashion, you shouldn't worry about what happens when it's being destroyed (@caps problem). Thus it's not your worry about the lifetime of the objects -- it's for the code that uses them.
Skipping dtors is trivial in even worst debuggers
And this is code that should be there if it runs there via dtors
@Alexandru I remember seeing the SO question about that.
02:31
So just moving it elsewhere changes nothing
@CatPlusPlus Sure. But if the "blow up" happens in the destructor.
user1646075
@caps these essays are famous: icu-project.org/docs/papers/cpp_report/… and icu-project.org/docs/papers/cpp_report/… - they don't explicitly cover RAII etc but the subject matter is done to good depth.
Then if you call all your deletes before the scope ends you know it happens there and not in any of the other destructors.
@MarkGarcia You're the code that uses them so yes it is your worry
user1646075
send him there. Or would it scare him off,...
02:32
@caps What blow up what
@Mysticial That was an interesting exercise for me
@MarkGarcia False. His example was if your delete ends up deleting memory it shouldn't have (I can only assume because of a bad destructor)
If you have 'blow ups' then RAII is not optional, because it's extremely hard to do exception safety in C++ without RAII
@caps That's an invariant violation
@Alexandru Unfortunately, I haven't tried it though. Mostly because I've been too lazy to figure out the ring0 access stuff.
Our implementation of C++ supports __try __finally
02:33
Deleting wrong memory is just a symptom
@CatPlusPlus A destructor that has an access violation?
Sure.
@caps It shouldn't end up having memory it really shouldn't own anyway.
The bug is there whether you hit that or not
@MarkGarcia should being the operative word.
@Mysticial I have a full solution on my site with all that shit, it just..."WORKS" lol but yeah, theres just a simple method call to get the kernel driver to do shit
02:34
If you write broken code you have broken code WHO WOULDVE THOUGHT
@CatPlusPlus Yes. But if you have to step through all the other destructors to see that it is happening in this specific destructor, it takes more time for all the step-throughs. That is his main point.
@caps Again, this is code that would be there anyway
@CatPlusPlus Yes.
So it's really not RAII's fault.
I.e. it's dumb and ugh
02:36
@CatPlusPlus string a; someclass * b = new someclass(); delete b; //<-- code explodes here, I didn't have to step through a's destructor to see that
Do you not know the concept of a backtrace
Simple example, but x50 variables and it becomes more of a pain.
hm?
Pinpointing the source of a fault is a trivial solved problem that doesn't require any stepping through
How?
And if it's a logic error then again dtors make literally zero difference
user1646075
02:37
@caps are you on his side or the side of righteousness? Shouldn't you be inventing reasons why you're right?
@aclarke I'm playing devil's advocate to a certain degree. Presenting his arguments as best I can so I can see your counters.
@caps Well, x50 variables means x50 points of usage. But still same code that's being invoked.
@caps Uh because it's part of the exception context
"Where" is rarely a problem for straight faults
(That's equally true for SEH exceptions, fault signals and C++ exceptions)
Maybe our debugger is really sucky.
It wouldn't surprise me--a lot of other things about our IDE are buggy and lame.
We kept having all of these memory issues in one of our issues.
Took us a week to figure out we were doing a memcpy on a class that used to have an array but it had been changed to a vector instead
Because we weren't getting any kind of error or message when that initially caused memory issues.
But then after some use our state would be corrupted and we'd get an access violation, but never in the same place.
02:53
@Mysticial Mind if I ask you a quick Q?
@Mysticial I'm calling NtQueryObject, and its known that NtQueryObject hangs in some cases. I've seen it hang on handles with the following GrantedAccess values: (handle.GrantedAccess == 1179785 || handle.GrantedAccess == 1180041 || handle.GrantedAccess == 1180063)
@Mysticial Its mostly been trial and error, but any clue what these access rights have in common?
What's NtQueryObject?
Its a sweet fucking function that you can use to see what processes have file handles open and where :) msdn.microsoft.com/en-us/library/bb432383(v=vs.85).aspx
The Nt prefix implies its a kernel-mode method but you can actually call it from user mode
It hooks pretty deep into OS shit, its what Systernals uses for their handle.exe app
user1646075
03:10
@Alexandru what is the break-down of the bits in those numbers?
0b100100000000010001001
0b100100000000110001001
0b100100000000110011111
user1646075
and ... what high-level concepts to those bits map to? I'm assuming they're or-ed flags, so can you turn that into constant names?
I haven't got a clue
Also its hard to make generalizations I guess, I'm not sure if they could just be one-offs
user1646075
where's a reference page for handle.GrantedAccess describing the value then?
Heh, that's where it gets a little qwerky :) These are undocumented APIs in Windows, and...for all intents and purposes the handle is a SYSTEM_HANDLE type defined as:
typedef struct _SYSTEM_HANDLE
{
ULONG ProcessId;
BYTE ObjectTypeNumber;
BYTE Flags;
USHORT Handle;
PVOID Object;
ACCESS_MASK GrantedAccess;
} SYSTEM_HANDLE, *PSYSTEM_HANDLE;
Luckily, ACCESS_MASK does exist...
03:21
I wrote a chronjob that stops httpd dumps all the tables, drops all the tables, and loads them again. Seems to avoid innodb fragmentation. Is anybody impressed with my system admin skills?
5
user1646075
@Mikhail eww?
user1646075
does not MySQL support online defragging? eww?
user1646075
goddamn all my attempts to follow your links to msdn are crapping out. That's probably a blessing...
I think myisam could kinda defragment, but the results were not satisfactory
Remarks
The bits in this value are allocated as follows.
Bits Meaning
0–15
Specific rights. Contains the access mask specific to the object type associated with the mask.
16–23
Standard rights. Contains the object's standard access rights.
24
Access system security (ACCESS_SYSTEM_SECURITY). It is used to indicate access to a system access control list (SACL). This type of access requires the calling process to have the SE_SECURITY_NAME (Manage auditing and security log) privilege. If this flag is set in the access mask of an audit access ACE (successful or unsuccessful access), the SACL acc
03:24
Indeed, my solution is so pragmatic it tickles my prostate
user1646075
MSDN hates me.
user1646075
feeling is mutual
user1646075
dayyum. Cannot get to a frikken page.
lol
#MSDNBlockedAustralia
#KimDotCom
http://www.microsoft.com/library/media/1033/technet/images/abouttn/subscriptions/flash/tn_comic_20090325.gif

Looks like an API change for better virus compatibility?
user1646075
03:27
MAYBE I still have MSVC and all the help subjects downloaded locally on a windoze VM.
Wow Qt. 14 MB for an ONLINE INSTALLER?
lol, it probably need to bundle all the Qt libraries
user1646075
hmmm - there's an "ACCESS MASK (Windows)" and "ACCESS MASK (Windows drivers)" - since you're calling something from the bowels of hell, are you sure it's the (windows) type?
@aclarke Just "went to definition", here's what turned up (its the driver type)
////////////////////////////////////////////////////////////////////////
// //
// ACCESS MASK //
// //
////////////////////////////////////////////////////////////////////////

//
// Define the access mask as a longword sized structure divided up as
// follows:
//
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
////////////////////////////////////////////////////////////////////////
//                                                                    //
//                             ACCESS MASK                            //
//                                                                    //
////////////////////////////////////////////////////////////////////////

//
//  Define the access mask as a longword sized structure divided up as
//  follows:
//
//       3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
user1646075
ok, to spare me the horrible binary maths and pattern matching, which bits are lit up? dump the names of the constants those bits represent
03:41
The numbers as 32-bit DWORDS to binary are:

00000000000100100000000010001001
00000000000100100000000110001001
00000000000100100000000110011111
Adgadasf. I just wasted the whole night debugging and all did was use a wrong variable in one of my getters.
Lit up are (always): READ_CONTROL (17), and SYNCHRONIZE (20)
READ_CONTROL -> Read access to the owner, group, and discretionary access control list (DACL) of the security descriptor.
The other lit up bits are just SpecificRights garbage
user1646075
you sure there's nothing special in them?
Could be, but I can't find a good article on these puppies
user1646075
so any handle with these common bits ALWAYS hangs the call?
03:50
I need to test that hypothesis and see what other threads are set to
but right now I'm trying to thread it out and nuke the thread thats hanging, maybe that will work
user1646075
test away! since it's an undocumented call... forensics all the way
@aclarke These APIs are crazy.
@aclarke What a treat :D hah
user1646075
YOU called 'em!
@aclarke Do you know if a thread needs to be created in some special way using CreateThread if you plan on using TerminateThread on its handle?
LOL
Hey CPPers what are you talikng about?
talking*
user1646075
03:55
@Alexandru nfi - you're speaking windows!
Ah, the mess of WinAPI :)
ohh .. someone still messing up with windows api
user1646075
iirc, in posix you can make a thread pre-detached so you don't need to join it. otherwise you need to join it to avoid it going all zombie on you.
@ProblemSolver Yeah, its a real "treat"
@Alexandru I thought the real <treat> nowadays is about messing up with mobile Api for android and ios ..
03:59
@Mikhail Or maybe use OPTIMIZE TABLE instead
user1646075
yeah. posix does. Haven't made a thread in over a year so of course I've totally forgotten it. Anyway, there's a fair chance that win is the same since it's very normal to either want a thread to do it's thing then bugger off quietly, or for you to wait for it to end. Can't see win not supporting that
have a nice day and winapis :P
you too :)
user1646075
@ProblemSolver thanks for your help, Captain Problem Solver!
user1646075
what's your superhero costume colours?
04:03
Why does sdl have so many more pro games made with it than other libs. Sigh.
Truly the worst thing that ever happened
05:04
Anyone here have experience implementing compilers?
Well, maybe experience implementing compilers isn't actually necessary to answer my question. I'm wondering at what point in the compilation process abstract references to static data are turned into concrete offsets.
Late stages of codegen
Well relative offsets maybe earlier
05:22
@CatPlusPlus How late, exactly?
Assembler/linker deal with absolute references
Relative offsets probably get computed somewhere during IR generation
05:35
Hm, I see. Thanks.
06:15
foo_type* return_array(size_t* place_to_store_size) is a sane way to return an "array" from a C function, right?
if my non-template class has a template member function, should I have to forward declare any instantiations of that templated function?
@Maxpm I don't know of many APIs that do this.
but then again I don't work with many APIs like that
instead they return opaque types and abstract the array away
@Maxpm Yes
@Rapptz Ah. That's probably a better way to do it.
Probably better in C would be return_code return_array(foo_type** array_out, size_t* size).
06:24
with opaque types it'd be foo_t* Foo_NewFoo() or whatever and then it'd return NULL for errors.
Don't forget get_last_error();)
lol
yeah that too
I hate it
Can't figure out why I would get "unresolved external" when the template function is defined inline right there in the class
06:40
gah
06:59
@caps Is it in a header?
@JerryCoffin Yes.

« first day (1487 days earlier)      last day (3678 days later) »