• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 06:25
CEST 12:25
KST 19:25
  • 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
[ASL21] Ro8 Preview Pt2: Progenitors4Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun13[ASL21] Ro8 Preview Pt1: Inheritors16[ASL21] Ro16 Preview Pt2: All Star10Team Liquid Map Contest #22 - The Finalists22
Community News
RSL Revival: Season 5 - Qualifiers and Main Event10Code S Season 1 (2026) - RO12 Results12026 GSL Season 1 Qualifiers25Maestros of the Game 2 announced92026 GSL Tour plans announced15
StarCraft 2
General
Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool Code S Season 1 (2026) - RO12 Results Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun Team Liquid Map Contest #22 - The Finalists MaNa leaves Team Liquid
Tourneys
2026 GSL Season 2 Qualifiers Sparkling Tuna Cup - Weekly Open Tournament StarCraft Evolution League (SC Evo Biweekly) $1,400 SEL Season 3 Ladder Invitational RSL Revival: Season 5 - Qualifiers and Main Event
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
Mutation # 524 Death and Taxes The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base
Brood War
General
Why there arent any 256x256 pro maps? BW General Discussion ASL21 General Discussion [ASL21] Ro8 Preview Pt2: Progenitors BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[ASL21] Ro8 Day 3 [ASL21] Ro8 Day 2 [Megathread] Daily Proleagues Escore Tournament StarCraft Season 2
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates What's the deal with APM & what's its true value Any training maps people recommend?
Other Games
General Games
Daigo vs Menard Best of 10 Stormgate/Frost Giant Megathread OutLive 25 (RTS Game) Dawn of War IV Nintendo Switch Thread
Dota 2
The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread European Politico-economics QA Mega-thread Russo-Ukrainian War Thread 3D technology/software discussion Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion McBoner: A hockey love story
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Movie Stars In Video Games: …
TrAiDoS
ramps on octagon
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1582 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
Poland17743 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
Poland17743 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
Poland17743 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
Afreeca Starleague
10:00
Ro8 Match 3
Jaedong vs Light
Afreeca ASL 18844
StarCastTV_EN537
Liquipedia
Replay Cast
09:00
WardiTV Mondays #80
CranKy Ducklings134
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Lowko125
StarCraft: Brood War
Calm 15592
Bisu 8250
Sea 3984
BeSt 1423
Soulkey 875
EffOrt 721
Pusan 492
Zeus 359
Larva 264
Soma 258
[ Show more ]
hero 196
Killer 155
Hyun 152
PianO 108
ToSsGirL 91
Backho 69
Sharp 59
Hm[arnc] 39
Barracks 34
Sexy 30
Sacsri 25
JulyZerg 22
soO 19
GoRush 16
Terrorterran 15
Noble 6
ajuk12(nOOB) 4
Dota 2
monkeys_forever201
NeuroSwarm107
XcaliburYe83
ODPixel67
canceldota24
League of Legends
JimRising 431
Counter-Strike
x6flipin51
Super Smash Bros
hungrybox799
Other Games
singsing1060
ceh9649
Livibee11
Organizations
StarCraft: Brood War
UltimateBattle 257
Dota 2
PGL Dota 2 - Main Stream55
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 14 non-featured ]
StarCraft 2
• LUISG 48
• CranKy Ducklings SOOP41
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV214
League of Legends
• TFBlade670
Upcoming Events
Wardi Open
35m
Monday Night Weeklies
5h 35m
Replay Cast
13h 35m
Sparkling Tuna Cup
23h 35m
Afreeca Starleague
23h 35m
Snow vs Flash
WardiTV Invitational
1d
SHIN vs Nicoract
Solar vs Nice
GSL
1d 23h
Classic vs Cure
Maru vs Rogue
GSL
2 days
SHIN vs Zoun
ByuN vs herO
OSC
3 days
OSC
3 days
[ Show More ]
Replay Cast
3 days
Escore
3 days
The PondCast
3 days
WardiTV Invitational
4 days
Zoun vs Ryung
Lambo vs ShoWTimE
Replay Cast
4 days
CranKy Ducklings
4 days
RSL Revival
4 days
SHIN vs Bunny
ByuN vs Shameless
WardiTV Invitational
5 days
Krystianer vs TriGGeR
Cure vs Rogue
uThermal 2v2 Circuit
5 days
BSL
5 days
Replay Cast
5 days
Sparkling Tuna Cup
5 days
RSL Revival
5 days
Cure vs Zoun
Clem vs Lambo
WardiTV Invitational
6 days
BSL
6 days
Replay Cast
6 days
Afreeca Starleague
6 days
Liquipedia Results

Completed

Proleague 2026-05-02
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
SCTL 2026 Spring
RSL Revival: Season 5
2026 GSL S1
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026

Upcoming

YSL S3
Escore Tournament S2: W6
KK 2v2 League Season 1
BSL 22 Non-Korean Championship
Escore Tournament S2: W7
Escore Tournament S2: W8
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 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.