Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411644 Posts in 69395 Topics- by 58450 Members - Latest Member: pp_mech

May 14, 2024, 10:26:39 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)The grumpy old programmer room
Pages: 1 ... 207 208 [209] 210 211 ... 295
Print
Author Topic: The grumpy old programmer room  (Read 740204 times)
Kekskiller
Guest
« Reply #4160 on: June 11, 2013, 01:26:12 AM »

I'd appreciate less genital mutilation chatter though.

Yeah this seems more applicable in the happy programmer room.

It's not actually about just VC++ STL but rather that I just can't get anything out of the debugger. Stuff like:
Code:
std::list<std::string> list[COUNT];
always results in the first string beeing viewable but nothing more. Another thing really dislike about STL is ::iterator stuff you need to append. Maybe it's just me preferring my own storage classes (beeing less bloated) over the theoretically great and flexible STL. I just don't like it that much. That's all. It makes me grumpy to work with STL from a minimalist point of view.
Logged
Geti
Level 10
*****



View Profile WWW
« Reply #4161 on: June 11, 2013, 03:02:01 AM »

If you dont have any legacy support concerns, use C++11
Code:
// old using fat iterator typenames
std::vector<int> vec;
for (std::vector<int>::iterator it = vec.begin(); it != vec.end(); ++it)
{
    whatever(*it);
}
Code:
// new using auto
std::vector<int> vec;
for (auto it = vec.begin(); it != vec.end(); ++it)
{
    whatever(*it);
}

With EA STL I'm able to inspect all elements of a list by following the next pointers. Can't remember for non EA STL and don't feel like checking.

From what I see in your code there you're actually making an array of lists of strings of length count, though, not a list of length count. Maybe there's some magic initialiser from [] stuff I've never encountered, but that would explain there only being one element Smiley

I'm not a fan of STL either fwiw but we don't have the development time luxury others seem to at THD; we eat enough time just implementing the whole destructible terrain multiplayer combat sidescroller thing that implementing our own containers for anything besides network optimisation (we have a custom bitstream class for that) seems like a waste of time.
Logged

Schrompf
Level 9
****

C++ professional, game dev sparetime


View Profile WWW
« Reply #4162 on: June 11, 2013, 03:09:17 AM »

Visual Studio provides these debug view beautifiers that are intended to display the contents of STL containers and other stuff in a friendly way. For example, you don't need to click through the nodes of a map to see its contents but instead get a plain list like this:

Code: (cpp)
[+] [0] ( "key", { value, somestruct } )
[+] [1] ( "stuff", { 45, otherstruct } )

Pretty useful in my opinion, but it might be fooled by your array-of-containers-in-containers example. I already wrote custom display helpers for some of my specialized container classes. The syntax for it is so convoluted and state-laden that I'm not surprised it fails on complex nested containers.

edit says: I also recommend C++11 if you have access to it. auto saves you a fuckton of typing, the for-each loops are even sexier, move semantics gained me 20% framerate just by switching to the new compiler and the MS-enabled STL. Not to talk about all the other new stuff.
Logged

Snake World, multiplayer worm eats stuff and grows DevLog
Kekskiller
Guest
« Reply #4163 on: June 11, 2013, 05:07:22 AM »

I'm not a fan of STL either fwiw but we don't have the development time luxury others seem to at THD
Yep, I'd love to put in my own storage classes and iter loops (macros are great for stuff likethat) but it'd cost more time implementing/integrating than just using what's already there. Plus there's already a ton of code someone had written before I joined so I'd need convert this, too.

Pretty useful in my opinion, but it might be fooled by your array-of-containers-in-containers example.
Yep, only simple containers seem to work reliably. Guess I'll need wrap some class around it... bah.
Logged
rivon
Level 10
*****



View Profile
« Reply #4164 on: June 13, 2013, 10:21:59 AM »

Kekskiller: I don't know if you got the message. You are using the STL containers in a wrong way... In your code example, you created an array of lists. You don't have to use [COUNT] stuff because STL containers use dynamic memory allocation and they can grow and shrink in size during runtime.
Logged
Kekskiller
Guest
« Reply #4165 on: June 13, 2013, 12:06:30 PM »

The code is exactly as it should be I can ensure you Wink

It's from a savegame manager that has COUNT sessions each having a list of savegame filenames. Whether it might be a good idea or not to combine it with simple C arrays or even structure it this way, it should be easily debuggable via Visual Studio but it isn't (that's simply the point of my post).

So yes, I konw that I could also use std::vector<std::list<std::string> > > but confused Visual Studio even more as well as my coworkers. Since the code became more complex I finally had the time to make seperate classes. Now Visual Studio's debugger finally understood what it's meant to display, geez.
Logged
Geti
Level 10
*****



View Profile WWW
« Reply #4166 on: June 14, 2013, 01:07:28 AM »

Out of interest, are you using some old version of VS or something? It should inspect lists, vectors, strings, and iterators of those without any hassle and I'm kind of interested in why it might be flubbing up for you. One thing VS usually does exceedingly well is debugging; it failing for something so basic is actually quite uncharacteristic ( no matter what bad press it might get from jaded devs Smiley )
Logged

Kekskiller
Guest
« Reply #4167 on: June 14, 2013, 01:17:16 AM »

We're using VS2010 with a ported project from VS2008 I think (it's an ooooold project). Not sure about what's turned off or whether the project has a special legacy version (don't have access to the project right now). But it seems to become better if there's more content in the container. Maybe I sort of reduces all the nesting with template class thingies, hm.

Oh and yes, it's otherwise a great debugger. Way more easy to debug foreign code than with GDB. Though I noticed that GDB works imho nicer for C projects and plainly structured data (you get "code" as output).
Logged
Geti
Level 10
*****



View Profile WWW
« Reply #4168 on: June 14, 2013, 04:19:06 AM »

I prefer not to use straight gdb if I can get away with it. Geany has a nice wrapper around it which makes it visual, somewhat like VS's (though imho less suited to large projects). It also has the option to swap to CLI everywhere as well, as I get the feeling quite a few people prefer that. Personally if I'm using the debugger it's to inspect stuff, and doing so from the command line sucks.
Codelite's graphical gdb integration is ok as well.

I'm a little grumpy at the moment cause I'm doing a lot of data-heavy stuff with inflexible formats and no editor, but it's a one off (at least for this week Roll Eyes ) so I cant be too mad.
Logged

d
Level 0
***


View Profile
« Reply #4169 on: June 14, 2013, 11:40:26 AM »

I lost two days on this one:

Code:
d.x = r.origin.x - l.origin.x;
d.y = r.origin.y - l.origin.z;
d.z = r.origin.z - l.origin.y;
Logged
Quarry
Level 10
*****


View Profile
« Reply #4170 on: June 14, 2013, 11:56:20 AM »

Code:
double d = Math.hypot(dX, dY);

hihihihihihihi
Logged
Fallsburg
Level 10
*****


Fear the CircleCat


View Profile
« Reply #4171 on: June 14, 2013, 12:57:09 PM »

Holy shit but not have root access makes things so much harder sometimes.
Logged
Dr. Cooldude
Guest
« Reply #4172 on: June 15, 2013, 04:38:38 PM »

<nongamedev>

Trying to find out how to invoke a PC speaker beep through a BIOS interrupt in x86 (INT 10h). For some reason, this code:

Code:
    mov ax, 0x0E07
    xor bx, bx
    int 0x10

made my computer restart... WTF

</nongamedev>
Logged
Kekskiller
Guest
« Reply #4173 on: June 15, 2013, 04:42:36 PM »

You sure know how to talk to computers.
This is the beginning of a highly intimate and erotic tale.
Logged
Dr. Cooldude
Guest
« Reply #4174 on: June 15, 2013, 04:48:28 PM »

Eight General Purpose Registers of Grey
Written by Younes Zakaria


oh god no
Logged
d
Level 0
***


View Profile
« Reply #4175 on: June 17, 2013, 03:11:33 PM »

Code:
    mov ax, 0x0E07
    xor bx, bx
    int 0x10

Surely your assembler doesn't treat unprefixed hex values as memory locations rather than immediates?
Logged
Dr. Cooldude
Guest
« Reply #4176 on: June 17, 2013, 10:41:35 PM »

Code:
    mov ax, 0x0E07
    xor bx, bx
    int 0x10

Surely your assembler doesn't treat unprefixed hex values as memory locations rather than immediates?

Yeah, pretty sure that NASM syntax treats it as immediates.

Just on an additional note, I'm working on kernel development (just for fun, nothing big), so we're talking about really low level stuff.
Logged
Dr. Cooldude
Guest
« Reply #4177 on: June 20, 2013, 12:23:36 PM »

Rant incoming!


Microsoft SQL Server CE is the most ass-retarded multihandicapped SQL server I've ever used, and we're going to use it for our exam project, even though it's a Windows PC application we're going to make and not an application for a fucking embedded system...



Sorry for these harsh words, but I'm just so annoyed that we're going to use an SQL server that's so unnecessarily limited (speaking of limitations, the damn LIMIT keyword doesn't even work in SQLCE). I mean, is it even necessary at all to use the extremely limited CE version of SQL Server for a Windows application?

Hm, maybe this is all just first-world problems (considering I was programming a kernel in x86 assembly above this post, OH THE IRONY), but it's annoying as hell to get stripped from almost half of all standard SQL functions when I'm already stressed enough to just at least finish this project in time.
Logged
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #4178 on: June 20, 2013, 03:47:07 PM »

weird is it different from standard msssql? I use it but always via entity framework so I never actaully write any sql for it.
Logged

Geti
Level 10
*****



View Profile WWW
« Reply #4179 on: June 20, 2013, 04:45:04 PM »

I'm in the in-between space between two exams on very different aspects of computer science, one yesterday on OO design, testing, agile development and trade-offs, the one today on C, perl, sh, unix utils (particularly sed) and unix history.

The one today is open book, which basically means they don't have to make concessions for not having the internet or documentation available because you can technically print the docs for the C and Perl standard libs, right?
 Droop

Rant incoming!
That sucks, facepunch whoever's in charge for not at least allowing sqlite as an alternative if there's concerns about using something more heavyweight, or not using the normal ms server that you're surely ~5000x more likely to see in production than the CE one.
Logged

Pages: 1 ... 207 208 [209] 210 211 ... 295
Print
Jump to:  

Theme orange-lt created by panic