• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 15:08
CEST 21:08
KST 04:08
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL22] Ro24 Preview: Siren's Call8[ASL22] Ro24 Preview: Summer's End9Serral wins HomeStory Cup 2915Serral wins Maestros of the Game 244ByuL, and the Limitations of Standard Play3
Community News
Official StarCraft website teases new content ahead of BlizzCon?80Stellar Fest TWO the Moon (Dec 16-20)9Weekly Cups (August 24-30): Patches' balance mod takes over3New 3v3 BGH Ladder (and more) on ShieldBattery!40Weekly Cups (August 17-23): Zerg dominate the week6
StarCraft 2
General
Nexon wins bid to develop StarCraft IP content, distribute Overwatch mobile game SC4ALL: II Winner Will Earn a Spot at HSC 30! Weekly Cups (August 24-30): Patches' balance mod takes over Balance hotfix patch 5.0.16b (July 16) September World Ranking: herO leads, Serral climbs
Tourneys
Stellar Fest TWO the Moon (Dec 16-20) IntoTheTV X SOOP SC2 League : Weekly & Monthly SC2 INu's Battles#20 [BO.9] 2026 GSTL Announcement PIG STY FESTIVAL 8.0! (13 - 23 August)
Strategy
[G] Having the right mentality to improve
Custom Maps
Nexus Wars 2021 GUIDE [M] (2) Industrial Park
External Content
Mutation # 541 Binary Choice The PondCast: SC2 News & Results Mutation # 540 Dodge This Mutation # 539 Thunder Dome
Brood War
General
Official StarCraft website teases new content ahead of BlizzCon? ASL22 General Discussion Gypsy to Korea [Personal Project Share] Terran Defense v0.60 BW General Discussion
Tourneys
Brood War in Budapest ! WORTEX 2026 BW Finals KCM Race Survival 2026 Season 3 [Megathread] Daily Proleagues BSL LAN Party - Kraków 29-30 August - OPEN SIGNUPS
Strategy
Odyssey Mineral Stack Saturation Replay Review Process - What do you do? Game Theory for Starcraft Fighting Spirit mining rates
Other Games
General Games
Nintendo Switch Thread Diablo IV EVE Corporation [Maplestory Hardcore] Let's Play~!! General RTS Discussion Thread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
[TL LoL EUW IHs] Teemo shall perish TSM pausing esports and CLG Dead
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Power Rank TL Mafia Community Thread NeO.D_StephenKing vs This Guy From 1 Million Dance
Community
General
Things Aren’t Peaceful in Palestine US Politics Mega-thread Artificial Intelligence Thread Canadian Politics Mega-thread UK Politics Mega-thread
Fan Clubs
MarineLorD Fan Club The Creator Fan Club The ShoWTimE Fan Club
Media & Entertainment
Movie Discussion! Anime Discussion Thread
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023 NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Northern Ireland Global Starcraft
Blogs
Dreaming of BW patches (mod…
c3rberUs
Regacy Esports: The Bh…
regacyesports
Violent Games and Crime Rate…
TrAiDoS
LOCKPICKING NOOB
LUCKY_NOOB
Cathedral Of CS And NY pizza a…
FuDDx
Customize Sidebar...

Website Feedback

Closed Threads



Active: 8665 users

The Big Programming Thread - Page 461

Forum Index > General Forum
Post a Reply
Prev 1 459 460 461 462 463 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
March 30 2014 18:45 GMT
#9201
Just a guess, but is that your problem?

http://www.cplusplus.com/reference/iterator/reverse_iterator/base/

The base iterator is an iterator of the same type as the one used to construct the reverse_iterator, but pointing to the element next to the one the reverse_iterator is currently pointing to (a reverse_iterator has always an offset of -1 with respect to its base iterator).
If you have a good reason to disagree with the above, please tell me. Thank you.
Amnesty
Profile Joined April 2003
United States2054 Posts
March 30 2014 19:00 GMT
#9202
yes that was the problem.
I guess i should have looked it up, thought i was just a straight mapping.
I used base() before and don't remember dealing with that either.
Thank you.

The sky just is, and goes on and on; and we play all our BW games beneath it.
icystorage
Profile Blog Joined November 2008
Jollibee19350 Posts
Last Edited: 2014-03-31 04:16:04
March 31 2014 04:12 GMT
#9203
wrong thread
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
scudst0rm
Profile Joined May 2010
Canada1149 Posts
March 31 2014 06:39 GMT
#9204
On March 31 2014 13:12 icystorage wrote:
wrong thread


Though you were in the Big Progaming Thread, right?
You're like a one ranger army comin' at me...
icystorage
Profile Blog Joined November 2008
Jollibee19350 Posts
March 31 2014 06:46 GMT
#9205
nope lol. had some topic but i thought it was more fit in the 'ask and answer stupid questions' thread
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
Manit0u
Profile Blog Joined August 2004
Poland17838 Posts
Last Edited: 2014-03-31 18:43:31
March 31 2014 18:43 GMT
#9206
On March 30 2014 21:04 spinesheath wrote:
Also if this is C/C++, you should prefer:

if (null == instance)

In any case, there's no real norm to that. Just do it consistently.


I prefer to see which variable is being assessed in the if statement before seeing what is it put against.

For me it was always:

if ( instance == NULL )
{
return;
}
Time is precious. Waste it wisely.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
March 31 2014 18:52 GMT
#9207
As I said, I find the C/C++ version harder to read too, but it provides that little extra safety against typos. In languages like C# where you don't have the stupid implicit pointer to bool cast, you don't need it.
If you have a good reason to disagree with the above, please tell me. Thank you.
Manit0u
Profile Blog Joined August 2004
Poland17838 Posts
March 31 2014 19:38 GMT
#9208
Well, the best way to write it and avoid any confusion would be this:


if ( !instance )
{
return;
}


Personally, I only use NULL pointer only in ANSI C when releasing memory after malloc. Just a habit I acquired which lets me identify methods that are there only to invoke release on a glance.
Time is precious. Waste it wisely.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
March 31 2014 19:59 GMT
#9209
On April 01 2014 04:38 Manit0u wrote:
Well, the best way to write it and avoid any confusion would be this:


if ( !instance )
{
return;
}


Personally, I only use NULL pointer only in ANSI C when releasing memory after malloc. Just a habit I acquired which lets me identify methods that are there only to invoke release on a glance.

You're using the still stupid implicit pointer to bool conversion there. And you have to know that there is an implicit conversion when you read/write that or else you're just banking on something that "seems to work", which is a really dangerous place to be in with C/C++.
If you have a good reason to disagree with the above, please tell me. Thank you.
nunez
Profile Blog Joined February 2011
Norway4003 Posts
March 31 2014 20:10 GMT
#9210
it doesn't get more unequivocal than doing an equal to with a nullptr in c++ at least.
don't even have to see the type of instance to deduce what's going on.
conspired against by a confederacy of dunces.
Cyx.
Profile Joined November 2010
Canada806 Posts
March 31 2014 21:18 GMT
#9211
On April 01 2014 03:52 spinesheath wrote:
As I said, I find the C/C++ version harder to read too, but it provides that little extra safety against typos. In languages like C# where you don't have the stupid implicit pointer to bool cast, you don't need it.

Or you could compile with warnings as errors, then you get the best of both worlds - compiler error when you typo, and you don't have to make your code awkward to read ^^
bangsholt
Profile Joined June 2011
Denmark138 Posts
March 31 2014 22:03 GMT
#9212
On April 01 2014 06:18 Cyx. wrote:
Show nested quote +
On April 01 2014 03:52 spinesheath wrote:
As I said, I find the C/C++ version harder to read too, but it provides that little extra safety against typos. In languages like C# where you don't have the stupid implicit pointer to bool cast, you don't need it.

Or you could compile with warnings as errors, then you get the best of both worlds - compiler error when you typo, and you don't have to make your code awkward to read ^^

Except that you now end up having to #pragma you way out of warnings, which are dangerous as well as they are now ignored on a whole line

And potentially silly ones - as an example, I work with embedded as part of my job, and there's a simple macro that's nice to use


#define _BV(bit) (1 << (bit))


Combined with #define you now use code like this


#define SHIELD_UP 0
#define SHIELD_DOWN 1
#define SHIELD_MOVING 2
#define SHIELD_ERROR

if(ui8Input & _BV(SHIELD_UP))
{
/* do something */
}
else if(ui8Input & _BV(SHIELD_DOWN))
{
/* do something else */
}


And so on - by the way, spot the compiler warning in the above

Yep - it's this line

ui8Input & _BV(SHIELD_UP)


The warning is simply that the shift does not have any effect - but if you remove it, you may hide a bug that's surprisingly hard to notice, because the macro and define are both super simple - which is why I dislike "treat warnings as errors"

Of course you shouldn't have any warnings - but it's just as dangerous to #pragma them out or annoying to set warnings as error
nunez
Profile Blog Joined February 2011
Norway4003 Posts
April 01 2014 06:49 GMT
#9213
bagsholt works for protoss.
conspired against by a confederacy of dunces.
Manit0u
Profile Blog Joined August 2004
Poland17838 Posts
April 01 2014 07:21 GMT
#9214
Holy crap, I almost got a heart attack...

I got a small gig regarding the creation of a simple file format converting program for a company. Took me several days but I managed to do it (had to be in C# in which I didn't do anything before that). I let them know I'm ready to show and test the app with users to spot and get rid of any quirks that might still be there. In preparation I've decided to clean up some stuff on my machine, I had 2 folders with the same name, one in my workspace area and one outside of it. Without thinking much I delete the one that's outside the workspace... You guessed it, that was the finished app and in the workspace was the "backup" that was basically at the start of it, non-functional and useless. Had to sit there to 5 a. m. re-creating the app, doing stuff quick and dirty (gone are all the methods testing for file validity, value testing stuff etc.) but it works as intended if you do everything as you're supposed to.

Testing starts today, I don't have time to fix it any further until then. Crossing my fingers...
Time is precious. Waste it wisely.
nunez
Profile Blog Joined February 2011
Norway4003 Posts
April 01 2014 07:26 GMT
#9215
holy crap justified.
good luck.
conspired against by a confederacy of dunces.
icystorage
Profile Blog Joined November 2008
Jollibee19350 Posts
April 01 2014 07:36 GMT
#9216
im actually pissed reading that lol. im like "WHY WOULD YOU DELETE STUFF IN A CRITICAL MOMENT?!"
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
Manit0u
Profile Blog Joined August 2004
Poland17838 Posts
April 01 2014 08:41 GMT
#9217
On April 01 2014 16:36 icystorage wrote:
im actually pissed reading that lol. im like "WHY WOULD YOU DELETE STUFF IN A CRITICAL MOMENT?!"


I was working crazy hours and my brain didn't process stuff as intended...
Time is precious. Waste it wisely.
MichaelEU
Profile Joined February 2011
Netherlands816 Posts
April 01 2014 09:10 GMT
#9218
On April 01 2014 17:41 Manit0u wrote:
Show nested quote +
On April 01 2014 16:36 icystorage wrote:
im actually pissed reading that lol. im like "WHY WOULD YOU DELETE STUFF IN A CRITICAL MOMENT?!"


I was working crazy hours and my brain didn't process stuff as intended...


What happened to version control?
世界を革命する力を!― znf: "Michael-oniichan ( *^▽^*)ノ✩キラ✩"
Rollin
Profile Joined March 2011
Australia1552 Posts
April 01 2014 10:33 GMT
#9219
On April 01 2014 18:10 MichaelEU wrote:
Show nested quote +
On April 01 2014 17:41 Manit0u wrote:
On April 01 2014 16:36 icystorage wrote:
im actually pissed reading that lol. im like "WHY WOULD YOU DELETE STUFF IN A CRITICAL MOMENT?!"


I was working crazy hours and my brain didn't process stuff as intended...


What happened to version control?

"What's that?"
Throw off those chains of reason, and your prison disappears. | Check your posting frequency timeline: http://www.teamliquid.net/mytlnet/post_activity_img.php
Manit0u
Profile Blog Joined August 2004
Poland17838 Posts
April 01 2014 10:48 GMT
#9220
On April 01 2014 18:10 MichaelEU wrote:
Show nested quote +
On April 01 2014 17:41 Manit0u wrote:
On April 01 2014 16:36 icystorage wrote:
im actually pissed reading that lol. im like "WHY WOULD YOU DELETE STUFF IN A CRITICAL MOMENT?!"


I was working crazy hours and my brain didn't process stuff as intended...


What happened to version control?


There wasn't any. Didn't want to bother with doing it for such a small project that I was working alone with. Came back to bite me in the ass in the end.
Time is precious. Waste it wisely.
Prev 1 459 460 461 462 463 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 14h 52m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
BRAT_OK 62
StarCraft: Brood War
Britney 20456
Shuttle 969
Hyuk 249
Horang2 206
HiyA 125
White-Ra 97
Free 35
scan(afreeca) 33
Rock 21
Mong 18
Counter-Strike
byalli863
pashabiceps627
edward112
Heroes of the Storm
Khaldor247
MindelVK11
Other Games
gofns19913
summit1g3913
fl0m2695
Grubby1427
Beastyqt767
B2W.Neo658
Mlord370
KnowMe339
PiGStarcraft167
XaKoH 119
dupreeh106
Mew2King60
QueenE57
Trikslyr37
Railgan3
Organizations
Other Games
gamesdonequick1125
EGCTV848
BasetradeTV21
[ Show 16 non-featured ]
StarCraft 2
• printf 57
• HeavenSC 6
• Response 1
• intothetv
• AfreecaTV YouTube
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• Michael_bg 8
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• masondota2677
• WagamamaTV588
Other Games
• imaqtpie1402
• Shiphtur267
Upcoming Events
Sparkling Tuna Cup
14h 52m
OSC
16h 52m
Shopify Rebellion Sundays
19h 52m
Mixu vs TBD
Spirit vs TBD
Clem vs TBD
Patches Events
20h 52m
OSC
1d 4h
Afreeca Starleague
1d 14h
Soma vs Shuttle
BeSt vs Rush
WardiTV Weekly
1d 15h
Monday Night Weeklies
1d 20h
Afreeca Starleague
2 days
Leta vs ggaemo
Jaedong vs Queen
GSL
2 days
[ Show More ]
PiGosaur Cup
3 days
Kung Fu Cup
3 days
Replay Cast
4 days
The PondCast
4 days
KCM Race Survival
4 days
Escore
5 days
IntoTheTV X SOOP
5 days
CranKy Ducklings
6 days
Liquipedia Results

Completed

Proleague 2026-09-02
PiG Sty Festival 8.0
Light Tournament 2026

Ongoing

KCM Race Survival 2026 Season 3
K-JUNGMAN
ASL Season 22
Super Anchor Qualifying S3
CSL 2026 AUTUMN (S22)
Acropolis #5
Acropolis #5 - TRS
RSL Revival: Season 6
Calamity Invitational
Big Dog Cup 2026 Div 1
BLAST Open Fall 2026
Esports World Cup 2026
Esports World Cup 2026: LCQ
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026

Upcoming

Escore Tournament S3: King of Kings
Blizzard Classic Cup 2026
Acropolis #5 - GSA
Acropolis #5 - GSB
Acropolis #5 - GSC
SC4ALL II: Brood War
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
BLAST Rivals Fall 2026
IEM Beijing 2026
Stake Ranked Episode 5
PGL Masters Bucharest 2026
1win Private Club #2
Thunderpick World Champ. '26
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
Logitech G Play Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #3
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.