• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 19:37
CET 01:37
KST 09:37
  • 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] Finals Preview: Sweet Victory!12[ASL22] Ro4 Preview: Mirror Mirror6[ASL22] Ro8 Preview: Within Reach5[ASL22] Ro8 Preview: In A Tizzy11[ASL22] Ro16 Preview: Holy Diver5
Community News
Weekly Cups (Oct 26 - Nov 1): MaxPax, herO, Solar win0Weekly Cups (October 19-25): Clem triples first in 5.0.175Evil Geniuses - shutting down23ISSL (IntoTheTV x SOOP SC2 League): Premier7Weekly Cups (October 12-18): 5.0.17 era begins1
StarCraft 2
General
[D] Hacker peak in sc2 ? No more SC2 streamers on team liquid? Liquibets sc2 season 30 Evil Geniuses - shutting down Weekly Cups (Oct 26 - Nov 1): MaxPax, herO, Solar win
Tourneys
SC4ALL: II Venue Change Announcement! Sparkling Tuna Cup - Weekly Open Tournament WardiTV Mondays ISSL (IntoTheTV x SOOP SC2 League): Premier Stellar Fest TWO the Moon (Dec 16-20)
Strategy
[H] ZvP Mid-Late Game: Stalkers Collossi HT
Custom Maps
[G] How to playtest arcade maps Starcraft 2 Advance [D] the control group Simple Questions/Answers
External Content
Mutation # 550 Graveyard Shift The PondCast: SC2 News & Results Mutation # 549 Endless Sparkles Mutation # 548 Shining Bright
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ Rollback Netcode in Brood War SC4ALL: II Venue Change Announcement! Ziemie's Starcraft 1 Prequel Campaign 🇺🇦 Ukrainian StarCraft:BroodWar community reborn
Tourneys
[$1250] International ShieldBattery League [Megathread] Daily Proleagues Small VOD Thread 2.0 KCM Race Survival 2026 Season 4
Strategy
50,000-Word Terran Builds Memo 2026-10-22 Cliff Jump Revisited (1 in a 1000 strategy) Simple Questions, Simple Answers
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Deus Ex 3!? Mobile Legends: Bang Bang Armies of Exigo - YesYes?
Dota 2
Dota 2 Champions League Season 3 Begins April 25!
League of Legends
[TL LoL EUW IHs] Teemo shall perish
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread
Community
General
US Politics Mega-thread Dating: How's your luck? Trading/Investing Thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread
Fan Clubs
Fan Club Resource Thread Reynor Fan Club The Flash Fan Club
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Recent Gifted Posts
Blogs
Why I built Repalyzer (1.1.…
BlueStar
Innovate or Game Over?
TrAiDoS
ShieldBattery on Mac
Kraekkling
[ASL22] Ro4 Day1 Ticket Giv…
bITt.mAN
Can Bots Beat Pros?? Starcr…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 10465 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
Poland17871 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
Poland17871 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
Poland17871 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
PSISTORM Gaming Misc
09:00
FSL season 12 opener: HM vs ST
Freeedom74
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SpeCial 39
StarCraft: Brood War
Britney 7687
Dota 2
PGG 213
League of Legends
Doublelift4873
JimRising 739
Counter-Strike
jkaem63
Other Games
gofns14930
summit1g8824
Grubby2065
Day[9].tv523
shahzam424
PiGStarcraft326
XaKoH 285
C9.Mang0283
syndereN178
Maynarde66
Fuzer 59
NeuroSwarm55
ViBE48
PPMD23
Railgan20
KnowMe15
JuggernautJason4
Organizations
Other Games
gamesdonequick512
Counter-Strike
PGL86
[ Show 18 non-featured ]
StarCraft 2
• Hupsaiya 77
• RyuSc2 24
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Laughngamez YouTube
• Migwel
StarCraft: Brood War
• HerbMon 38
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Nemesis3381
• Jankos3336
• Scarra898
Other Games
• imaqtpie613
• Day9tv523
• Shiphtur174
Upcoming Events
IntoTheTV X SOOP
10h 23m
Reynor vs Solar
ByuN vs SHIN
Clem vs MaxPax
herO vs Rogue
IPSL
16h 23m
WorsT vs nOmaD
Dewalt vs andersOn
AI Arena Tournament
18h 23m
IntoTheTV X SOOP
1d 10h
IPSL
1d 16h
Azhi_Dahaki vs ggnore13
Double vs WIZARD
Replay Cast
1d 22h
Replay Cast
2 days
Sparkling Tuna Cup
3 days
WardiTV Invitational
3 days
YoungYakov vs Lambo
SHIN vs TBD
Percival vs Shameless
Solar vs TBD
PiGosaur Cup
4 days
[ Show More ]
The PondCast
5 days
KCM Race Survival
5 days
WardiTV Invitational
5 days
Liquipedia Results

Completed

Proleague 2026-11-05
Blizzard Classic Cup 2026
HCC Season 3

Ongoing

Acropolis #5
KCM Race Survival 2026 Season 4
International ShieldBattery League
BSL Season 23
IPSL Winter 2026-27
Calamity Cup Div. A Season 8
IEM Beijing 2026
PGL Masters Bucharest 2026
Stake Ranked Episode 5
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
BLAST Open Fall 2026

Upcoming

Sector 951
SC4ALL II: Brood War
BSL 23: Non-Korean Championship
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
Underdog Cup 2026 Div 2-3
PGL Bucharest 2027
BLAST Bounty Winter 2027
eXTREMESLAND 2026
PGL Major Singapore 2026
Stake Ranked Episode 6
BLAST Rivals Fall 2026
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.