• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 14:52
CET 20:52
KST 04:52
  • 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
RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3RSL Season 3: RO16 results & RO8 bracket13
StarCraft 2
General
Chinese SC2 server to reopen; live all-star event in Hangzhou Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced Weekly Cups (Nov 24-30): MaxPax, Clem, herO win SC2 Proleague Discontinued; SKT, KT, SGK, CJ disband
Tourneys
Sea Duckling Open (Global, Bronze-Diamond) $5,000+ WardiTV 2025 Championship Constellation Cup - Main Event - Stellar Fest RSL Revival: Season 3 Tenacious Turtle Tussle
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation
Brood War
General
Which season is the best in ASL? Data analysis on 70 million replays BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ask the mapmakers — Drop your questions BW General Discussion
Tourneys
[Megathread] Daily Proleagues [BSL21] RO16 Group B - Sunday 21:00 CET [BSL21] RO16 Group C - Saturday 21:00 CET Small VOD Thread 2.0
Strategy
Game Theory for Starcraft How to stay on top of macro? Current Meta PvZ map balance
Other Games
General Games
Stormgate/Frost Giant Megathread ZeroSpace Megathread Nintendo Switch Thread The Perfect Game Path of Exile
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread
Community
General
Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine US Politics Mega-thread The Big Programming Thread Artificial Intelligence Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
James Bond movies ranking - pa…
Topin
Esports Earnings: Bigger Pri…
TrAiDoS
Thanks for the RSL
Hildegard
Saturation point
Uldridge
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1743 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
Poland17495 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
Poland17495 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
Poland17495 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
Poland17495 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
Poland17495 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
StarCraft2.fi
17:00
15V Cup / Groups Day 3
starcraft2fi 150
Reevou 14
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Fuzer 370
IndyStarCraft 112
StarCraft: Brood War
Calm 2797
Larva 294
Shuttle 247
ggaemo 112
Dewaltoss 107
Dota 2
qojqva5295
syndereN480
canceldota70
Counter-Strike
pashabiceps1570
edward201
Heroes of the Storm
Liquid`Hasu320
Other Games
Grubby3468
FrodaN941
DeMusliM837
KnowMe273
Sick209
C9.Mang0121
Livibee98
QueenE70
Trikslyr65
ZombieGrub18
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• HeavenSC 19
• IndyKCrew
• sooper7s
• AfreecaTV YouTube
• Migwel
• intothetv
• LaughNgamezSOOP
• Kozan
StarCraft: Brood War
• FirePhoenix12
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
League of Legends
• Nemesis2651
• TFBlade1158
Other Games
• imaqtpie1060
• Scarra554
• WagamamaTV403
• Shiphtur130
Upcoming Events
Replay Cast
4h 8m
The PondCast
14h 8m
OSC
20h 8m
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
1d 4h
Korean StarCraft League
2 days
CranKy Ducklings
2 days
WardiTV 2025
2 days
SC Evo League
2 days
BSL 21
3 days
Sziky vs OyAji
Gypsy vs eOnzErG
OSC
3 days
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
[ Show More ]
Sparkling Tuna Cup
3 days
WardiTV 2025
3 days
OSC
3 days
BSL 21
4 days
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
4 days
Wardi Open
4 days
StarCraft2.fi
4 days
Monday Night Weeklies
4 days
Replay Cast
5 days
WardiTV 2025
5 days
StarCraft2.fi
5 days
PiGosaur Monday
6 days
StarCraft2.fi
6 days
Liquipedia Results

Completed

Proleague 2025-11-30
RSL Revival: Season 3
Light HT

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
Acropolis #4 - TS3
META Madness #9
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
Kuram Kup
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
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 © 2025 TLnet. All Rights Reserved.