Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 333 334 [335] 336 337 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 903150 times)

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5010 on: September 22, 2013, 06:29:27 pm »

I guess that must be the line number of the library code, not the line number of your code. Can you post the full error please?
Logged

MrWillsauce

  • Bay Watcher
  • Has an ass that won't quit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5011 on: September 22, 2013, 06:39:56 pm »

---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!

Program: ... Studio 10.0\Projects\MrWillsauce2.0\Debug\MrWillsauce2.0.exe
File: c:\microsoft visual studio 10.0\vc\include\vector
Line: 932

Expression: vector subscript out of range

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.

(Press Retry to debug the application)
---------------------------
Abort   Retry   Ignore   
---------------------------
Logged

olemars

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5012 on: September 22, 2013, 07:24:10 pm »

That's a runtime error and not a compile error, so your program actually does start. If you hit retry when that message box appears (like it says) it'll dump you straight to the code location where the error happens.

In this case it's how you access the "tokens" vector, you need to make sure you don't try to read more elements from it than it actually contains (hint: vectors have a size function).
Logged

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5013 on: September 23, 2013, 10:42:09 am »

Apparently the version of Mingw(or gcc, I have no idea) that came with Code::Blocks doesn't support multithreading.

Does someone know how I could swap out mingw out for a version that supports multithreading?
Or barring that, how the hell I should get Boost working? The getting started guide refers to a file that doesn't exist.
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5014 on: September 23, 2013, 04:45:03 pm »

Apparently the version of Mingw(or gcc, I have no idea) that came with Code::Blocks doesn't support multithreading.

Does someone know how I could swap out mingw out for a version that supports multithreading?
Or barring that, how the hell I should get Boost working? The getting started guide refers to a file that doesn't exist.
That one's fun eh?

The c++11 threading is not yet supported for windows in gcc, so you still have to use boost threads (or go the posix-cygwin route but I never got that to work).
So in short, get boost, then compile the threading stuff (using cmake), then you can use it. Took me a week to get that working though :P
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

ECrownofFire

  • Bay Watcher
  • Resident Dragoness
    • View Profile
    • ECrownofFire
Re: if self.isCoder(): post() #Programming Thread
« Reply #5015 on: September 23, 2013, 05:20:24 pm »

Apparently the version of Mingw(or gcc, I have no idea) that came with Code::Blocks doesn't support multithreading.

Does someone know how I could swap out mingw out for a version that supports multithreading?
Or barring that, how the hell I should get Boost working? The getting started guide refers to a file that doesn't exist.
First of all, uninstall Code::Blocks and remove all configuration files (they're somewhere in AppData I think) then install the version without MinGW included.

Download this and put it somewhere without spaces in the name (it makes things a lot easier in general) and add the bin subdirectory to your PATH.

Now just follow these instructions with bootstrap.bat mingw.

Also, don't listen to Siquo, he doesn't know what he's talking about :P
« Last Edit: September 23, 2013, 05:21:59 pm by ECrownofFire »
Logged

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5016 on: September 24, 2013, 08:59:06 am »

Apparently the version of Mingw(or gcc, I have no idea) that came with Code::Blocks doesn't support multithreading.

Does someone know how I could swap out mingw out for a version that supports multithreading?
Or barring that, how the hell I should get Boost working? The getting started guide refers to a file that doesn't exist.
First of all, uninstall Code::Blocks and remove all configuration files (they're somewhere in AppData I think) then install the version without MinGW included.

Download this and put it somewhere without spaces in the name (it makes things a lot easier in general) and add the bin subdirectory to your PATH.

Now just follow these instructions with bootstrap.bat mingw.

Also, don't listen to Siquo, he doesn't know what he's talking about :P
If I'm gonna be replacing Mingw with a version that supports threads as a part of the standard library, then I don't really need Boost. How would I attach the new version to the compiler-less Code::Blocks?

Actually, I just remembered that SDL has multithreading. If they give me any trouble, then I'll rip out CodeBlocks' guts. Would still like an explanation on exactly how to do it, for when I have some similar problem in the future.

EDIT: Ayup. Doesn't work. Should have expected that.
« Last Edit: September 24, 2013, 09:19:20 am by cerapa »
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.

ECrownofFire

  • Bay Watcher
  • Resident Dragoness
    • View Profile
    • ECrownofFire
Re: if self.isCoder(): post() #Programming Thread
« Reply #5017 on: September 24, 2013, 10:47:59 am »

Look in Settings, Compiler..., Global compiler settings, make sure GNU GCC compiler is selected, Toolchain executables, choose the installation directory, gcc.exe for C compiler, g++ for C++ compiler and linker for dynamic libs, ar.exe for static linker, default debugger (GDB), windres.exe for resource compiler, and mingw32-make.exe for make program.
Logged

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5018 on: September 24, 2013, 11:46:57 am »

Spoiler (click to show/hide)
EDIT: Works perfectly now. Thank you so much for your help.
« Last Edit: September 24, 2013, 12:41:03 pm by cerapa »
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5019 on: September 24, 2013, 09:12:41 pm »

I had to write a Java program for a class assignment. The runner class had 82 lines of code, and 482 lines of comments. Comments that are overly verbose but yet required by the professor.

85% of that file was comments. This is ridiculous.

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #5020 on: September 25, 2013, 06:33:39 am »

I think I'd actually have gone and challenged the professor on that one xD Ask why he needs those comments since I'm a big believer in comments only being needed for things that you can't document in code or tests.

How code works? Code.
What code does? Tests.
Erroneous or unexpected behaviour that will go unfixed for the time being? Tests.
Why certain decisions were made that doesn't fit into the above 3? Comments.
Public API documentation? Javadoc/doxygen/XML comments.

Naturally outside of the last one, comments should be incredibly rare. Comments don't break, but tests do. They are superior for documentation because they force you to keep them maintained.

Actually the D programming language probably has one of the theoretically nicer ways of doing documentation than doc comments: it can generate documentation from a classes unit tests.
Logged

alexandertnt

  • Bay Watcher
  • (map 'list (lambda (post) (+ post awesome)) posts)
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5021 on: September 25, 2013, 08:22:14 am »

I had to write a Java program for a class assignment. The runner class had 82 lines of code, and 482 lines of comments. Comments that are overly verbose but yet required by the professor.

85% of that file was comments. This is ridiculous.

Try literate programming for more Fun...
Logged
This is when I imagine the hilarity which may happen if certain things are glichy. Such as targeting your own body parts to eat.

You eat your own head
YOU HAVE BEEN STRUCK DOWN!

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5022 on: September 25, 2013, 10:54:57 am »

I used to have a serious problem with over commenting, and that wasn't even including method documentation (which I almost never wrote).  Moving to a commenting paradigm closer to what MorleyDev describes took a bit of willpower but I think it's better overall.  I think the reason I used to over comment was an attempt to create something akin to that literate programming link.  I could read the comments for an English description of what a program was doing.  The problem of course, was that it more than doubled the size of most programs and the comments tended to rot.

Somewhat related, I really wish I could learn to move toward test driven development.  I also wish I could encourage my coworkers to do the same.  We almost exclusively write web applications that are amazingly brittle: one change somewhere seemingly quite unrelated causes problems days later when customers call in.  If we had a test suite to detect those faults it would be so helpful.

Quote
Actually the D programming language probably has one of the theoretically nicer ways of doing documentation than doc comments: it can generate documentation from a classes unit tests.

D has language support for unit testing?  That's interesting.  I've been very vaguely interested in learning D, but its lack of major mainstream support pretty much killed any serious chance of me looking at it.
Logged
Through pain, I find wisdom.

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5023 on: September 25, 2013, 02:40:25 pm »

I just convinced one of my coworkers that we should use Selenium for testing on a feature I'm working on (more like "We should use Selenium. Objections?" "Go right ahead!").

I didn't know what I was missing. There's nothing quite like writing out what I want to happen and then having my browser open up and automagically do stuff.
Logged

Dutchling

  • Bay Watcher
  • Ridin' with Biden
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5024 on: September 25, 2013, 02:41:43 pm »

So how do people here actually do comments?
Logged
Pages: 1 ... 333 334 [335] 336 337 ... 796