• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 05:06
CET 11:06
KST 19:06
  • 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
RSL Offline Finals Info - Dec 13 and 14! StarCraft Evolution League (SC Evo Biweekly) RSL Offline FInals Sea Duckling Open (Global, Bronze-Diamond) $5,000+ WardiTV 2025 Championship
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
BW General Discussion 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
Tourneys
[BSL21] RO16 Group D - Sunday 21:00 CET [BSL21] RO16 Group A - Saturday 21:00 CET [Megathread] Daily Proleagues [BSL21] RO16 Group B - Sunday 21:00 CET
Strategy
Current Meta Game Theory for Starcraft How to stay on top of macro? PvZ map balance
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread ZeroSpace Megathread 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 US Politics Mega-thread Things Aren’t Peaceful in Palestine 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
Physical Exertion During Gam…
TrAiDoS
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1332 users

The Big Programming Thread - Page 543

Forum Index > General Forum
Post a Reply
Prev 1 541 542 543 544 545 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.
Gowerly
Profile Blog Joined July 2011
United Kingdom916 Posts
November 05 2014 14:40 GMT
#10841
I posted that link and then realised I didn't mean it.
If I'm in Ruby, I will put braces in differently. If I'm doing something like

myArr.each { |item|
item.DoThing()
}

then my braces are like that. I don't know if Ruby even works without it as I'm still rather new.
I will reduce you to a series of numbers.
Manit0u
Profile Blog Joined August 2004
Poland17496 Posts
Last Edited: 2014-11-05 15:01:42
November 05 2014 14:59 GMT
#10842
Ok guys, now I have a different problem... Had to switch branches with the code, all looks fine, except there's 2x more code like stuff I posted on the previous page. I ignore it for the moment but there are other funny things happening.

1. Compiling this code to .war produces file that's 5x smaller than previously, probably missing some dependencies...
2. Errors be thrown: java.lang.NoClassDefFoundError, definitely dependencies are missing...
3. 'mvn depdendency:resolve' downloads all the required stuff, 1 and 2 remain unchanged.

Help? I've recompiled the code like 15 times now, updated everything, all looks cool and dandy, maven is able to install, clean package and all that jazz, but it doesn't work

And yes, all deps are properly included in pom.xml and class that's throwing the error does import the right thing.
Time is precious. Waste it wisely.
bangsholt
Profile Joined June 2011
Denmark138 Posts
November 05 2014 16:14 GMT
#10843
As long as the code is formatted in a consistent way, I don't mind how it's written.

My personal preferences are to follow the style guide of the language you're working in - with the exception of C, where I strongly prefer the Linux Kernel Style.

If it's not consistent, abuse CTRL + K, CTRL + D in VS, CTRL + SHIFT + F in Eclipse or ALT + CTRL + L in IntelliJ.

Now it is.

spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
November 05 2014 17:05 GMT
#10844
On November 06 2014 01:14 bangsholt wrote:
As long as the code is formatted in a consistent way, I don't mind how it's written.

My personal preferences are to follow the style guide of the language you're working in - with the exception of C, where I strongly prefer the Linux Kernel Style.

If it's not consistent, abuse CTRL + K, CTRL + D in VS, CTRL + SHIFT + F in Eclipse or ALT + CTRL + L in IntelliJ.

Now it is.


And then you pray that you're not the guy who has to merge that with another branch that has code changes in the files you just touched.
If you have a good reason to disagree with the above, please tell me. Thank you.
nunez
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2014-11-05 18:43:09
November 05 2014 18:25 GMT
#10845
On November 06 2014 01:14 bangsholt wrote:
As long as the code is formatted in a consistent way, I don't mind how it's written.

i am with you brother.
i associate a narrow mind with syntax tears.
conspired against by a confederacy of dunces.
Saumure
Profile Joined February 2012
France404 Posts
Last Edited: 2014-11-05 22:15:34
November 05 2014 20:56 GMT
#10846
Hi guys,
I am pretty desperate
I wrote some c++ code in Qt and when I try to run the executable from the terminal, the program stops right after launching saying:
Illegal instruction

In Qt, when I try to debug, i get:
Debugging starts
&"warning: GDB: Failed to set controlling terminal: Inappropriate ioctl for device\n"

Can someone help me please?

EDIT: solved it
Manit0u
Profile Blog Joined August 2004
Poland17496 Posts
Last Edited: 2014-11-06 11:46:45
November 06 2014 08:48 GMT
#10847
On November 06 2014 03:25 nunez wrote:
Show nested quote +
On November 06 2014 01:14 bangsholt wrote:
As long as the code is formatted in a consistent way, I don't mind how it's written.

i am with you brother.
i associate a narrow mind with syntax tears.


I only want to cry if people don't put return statements on their own line and don't separate control statements from the rest of the code. I couldn't care less about where you put your bracers since I'm simultaneously working on several projects that have totally different brace-placement policy.
Time is precious. Waste it wisely.
Manit0u
Profile Blog Joined August 2004
Poland17496 Posts
Last Edited: 2014-11-06 13:26:50
November 06 2014 13:19 GMT
#10848
On November 05 2014 23:12 spinesheath wrote:
I retract the question. You're defining a method inside a class inside a method inside a class. This just can't be a good idea. Ever.

Is that 3rd method catching the exceptions it throws?


There are plenty of methods that:

a) throw 3 different exceptions in 7 different places
b) catch some of the exceptions they throw themselves and exceptions thrown by other events
c) call other methods that do the same, inside a loop, inside a loop (and those other methods also do such things)
d) there are methods inside classes inside methods inside classes inside methods inside classes and some of those methods are anonymous overrides to methods in classes higher in the order of hierarchy
e) in some classes there are methods that override basic stuff, like count() - my favorite part of it: if (total == 0) { total = 1; }, equals(), etc.

With every passing hour spent trying to understand this code I feel like I'm just diving into madness and going way too far down the rabbit hole...
Time is precious. Waste it wisely.
djookz
Profile Joined November 2014
1 Post
November 06 2014 13:55 GMT
#10849
Hey guys,
I've been an avid reader since this page came out but never felt the urge to make an account, but upon seeing this thread for the first time now (Usually not looking at General), I wanted to ask if some people here use R?
Chocolate
Profile Blog Joined December 2010
United States2350 Posts
November 06 2014 18:04 GMT
#10850
Taking a database class centered around SQL (our professor is lazy and is making the course parallel to a course offered at Stanford, so if you have taken their course, it's like that). Should I expect this to be very hard? I hear it's very useful in the working world, but I'm currently at 13 hours (my next semester I'll be busy with non-school things) and I want to know if I should drop this class if I get into a more important CS class that I'm trying to get.
MichaelEU
Profile Joined February 2011
Netherlands816 Posts
November 06 2014 18:15 GMT
#10851
On November 07 2014 03:04 Chocolate wrote:
Taking a database class centered around SQL (our professor is lazy and is making the course parallel to a course offered at Stanford, so if you have taken their course, it's like that). Should I expect this to be very hard? I hear it's very useful in the working world, but I'm currently at 13 hours (my next semester I'll be busy with non-school things) and I want to know if I should drop this class if I get into a more important CS class that I'm trying to get.


SQL (or rather: database design, which likely involves SQL) is one of the most useful things to learn. It's not that difficult.
世界を革命する力を!― znf: "Michael-oniichan ( *^▽^*)ノ✩キラ✩"
Chocolate
Profile Blog Joined December 2010
United States2350 Posts
November 06 2014 18:22 GMT
#10852
Ok, thanks. Yeah I definitely plan on taking the class eventually but if this one class (intermediate software programming) my school claims to be very helpful to have already done before you start internships opens up, I was planning on swapping them. We'll see I guess.

Also, can any of you tell me why in the world Visual Studio won't let me compile the code on this line? I stared at this shit for half an hour last night and couldn't figure out why VS was being a bitch about it. It's a default constructor for a generic queue class that I have to write for a project

template <typename type>
Queue<type> ::Queue() : head(nullptr), tail(nullptr)
{
//hooray for base initialization
}


The error says "expected semicolon" and that the "<" and ">" don't make sense. I checked a billion times for missing curly brackets and semicolons above this code but couldn't find any.
Khalum
Profile Joined September 2010
Austria831 Posts
November 06 2014 19:07 GMT
#10853
Are you by any chance writing this code in a .cpp file? You can't do that.
Chocolate
Profile Blog Joined December 2010
United States2350 Posts
November 06 2014 19:42 GMT
#10854
Yes this is a .cpp file. I have it so that my .h file includes my .cpp so whenever I need to use a queue I include my .h. I did the same thing (I believe) when I made a generic stack class, and that class is working. I feel like I'm probably making some very obvious mistake but I can't identify it for the life of me.
Khalum
Profile Joined September 2010
Austria831 Posts
Last Edited: 2014-11-06 20:02:59
November 06 2014 19:53 GMT
#10855
You can't put template code in a .cpp file mate.

[edit] That was not well formulated. You can't declare/define template classes/functions in .cpp files.
Chocolate
Profile Blog Joined December 2010
United States2350 Posts
Last Edited: 2014-11-06 20:23:36
November 06 2014 20:23 GMT
#10856
I'm 99% sure you can though, I have a working Stack class where the default constructor is
template <typename type>
Stack<type>::Stack() : head(nullptr)
{
//no code
}
Khalum
Profile Joined September 2010
Austria831 Posts
November 06 2014 20:40 GMT
#10857
Please consider reading this: http://www.parashift.com/c -faq-lite/templates-defn-vs-decl.html
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2014-11-06 20:52:14
November 06 2014 20:44 GMT
#10858
--- Nuked ---
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2014-11-06 22:56:37
November 06 2014 22:50 GMT
#10859
I think this is a serious weakness. In general, you're supposed to separate implementation and interface (header files). Except that you can't with templates? Isn't there a better option than one file? I've read about 'export' but there is a warning that it'll be deprecated.

On November 07 2014 05:44 Nesserev wrote:
Show nested quote +
On November 07 2014 05:23 Chocolate wrote:
I'm 99% sure you can though, I have a working Stack class where the default constructor is
template <typename type>
Stack<type>::Stack() : head(nullptr)
{
//no code
}

You can put a rusty spoon in your ass... doesn't mean that you should do it.

The baseline is... you're not supposed to do stuff like including source files in your header files. Wtf, where do you even get this idea? Conventions, please. You're supposed to put all template definitions in the same file (.tpp or .hpp).

It makes sense that a compiler cannot compile a generic template directly like a normal class; templates are just a 'blueprint'. When you use the template, you basically create a new class, and for the compiler to generate that class, it needs all the information that is given by the class definition and class method definitions, so you put it in one file altogether.

The reason why it works if you include your source file from your header, is that #includes basically 'copy' the contents of that file to your translation unit... .h and .cpp are just extensions for the sake of conventions and clarity, so they're treated the same way. But just don't do this stuff... you probably forgot your guards and sh!t in your .cpp file. Dangerous slippery slope to hell and stuff..


Actually, some articles suggest including a source file from header so this is no surprise. Here is an example I'm reading at the moment:

http://stackoverflow.com/a/495056/1091781
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2014-11-06 23:09:09
November 06 2014 23:08 GMT
#10860
--- Nuked ---
Prev 1 541 542 543 544 545 1032 Next
Please log in or register to reply.
Live Events Refresh
The PondCast
10:00
Episode 74
CranKy Ducklings9
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SortOf 154
ProTech14
StarCraft: Brood War
Britney 32274
GuemChi 1534
Horang2 949
actioN 407
Jaedong 336
BeSt 303
Mini 293
Dewaltoss 159
Sharp 123
EffOrt 121
[ Show more ]
Pusan 92
Killer 89
Light 83
Sacsri 75
Barracks 52
ggaemo 52
Rush 48
hero 44
sorry 39
Hyun 30
ToSsGirL 29
Shine 27
Noble 21
Snow 20
soO 20
Shinee 16
Bale 13
Hm[arnc] 7
Dota 2
Fuzer 162
NeuroSwarm92
League of Legends
JimRising 419
C9.Mang0230
Reynor71
Counter-Strike
olofmeister1434
shoxiejesuss610
Super Smash Bros
Westballz8
Other Games
summit1g11729
WinterStarcraft587
ceh9546
crisheroes410
Happy389
Mew2King39
KnowMe1
ZerO(Twitch)1
Organizations
Other Games
gamesdonequick462
StarCraft: Brood War
Kim Chul Min (afreeca) 135
StarCraft 2
CranKy Ducklings1
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• LUISG 34
• Light_VIP 15
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• iopq 6
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota254
League of Legends
• Jankos1671
Upcoming Events
OSC
5h 54m
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
13h 54m
Korean StarCraft League
1d 16h
CranKy Ducklings
1d 23h
WardiTV 2025
2 days
SC Evo League
2 days
BSL 21
2 days
Sziky vs OyAji
Gypsy vs eOnzErG
OSC
2 days
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
Sparkling Tuna Cup
2 days
WardiTV 2025
3 days
[ Show More ]
OSC
3 days
BSL 21
3 days
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
3 days
Wardi Open
4 days
StarCraft2.fi
4 days
Monday Night Weeklies
4 days
Replay Cast
4 days
WardiTV 2025
5 days
StarCraft2.fi
5 days
PiGosaur Monday
5 days
StarCraft2.fi
6 days
Tenacious Turtle Tussle
6 days
The PondCast
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.