• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 14:34
CET 20:34
KST 04:34
  • 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
SC2 All-Star Invitational: Tournament Preview5RSL Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2
Community News
BSL Season 2025 - Full Overview and Conclusion6Weekly Cups (Jan 5-11): Clem wins big offline, Trigger upsets4$21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7)16Weekly Cups (Dec 29-Jan 4): Protoss rolls, 2v2 returns7[BSL21] Non-Korean Championship - Starts Jan 105
StarCraft 2
General
Stellar Fest "01" Jersey Charity Auction SC2 All-Star Invitational: Tournament Preview Weekly Cups (Jan 5-11): Clem wins big offline, Trigger upsets When will we find out if there are more tournament SC2 Spotted on the EWC 2026 list?
Tourneys
SC2 All-Star Invitational: Jan 17-18 Sparkling Tuna Cup - Weekly Open Tournament SC2 AI Tournament 2026 $21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7) OSC Season 13 World Championship
Strategy
Simple Questions Simple Answers
Custom Maps
Map Editor closed ?
External Content
Mutation # 509 Doomsday Report Mutation # 508 Violent Night Mutation # 507 Well Trained Mutation # 506 Warp Zone
Brood War
General
[ASL21] Potential Map Candidates BGH Auto Balance -> http://bghmmr.eu/ Video Footage from 2005: The Birth of G2 in Spain BW General Discussion BSL Season 2025 - Full Overview and Conclusion
Tourneys
[Megathread] Daily Proleagues [BSL21] Non-Korean Championship - Starts Jan 10 Small VOD Thread 2.0 Azhi's Colosseum - Season 2
Strategy
Soma's 9 hatch build from ASL Game 2 Simple Questions, Simple Answers Game Theory for Starcraft Current Meta
Other Games
General Games
Stormgate/Frost Giant Megathread Beyond All Reason Awesome Games Done Quick 2026! Nintendo Switch Thread Mechabellum
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread Canadian Politics Mega-thread European Politico-economics QA Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece
Sports
2024 - 2026 Football Thread
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
My 2025 Magic: The Gathering…
DARKING
Physical Exercise (HIIT) Bef…
TrAiDoS
Life Update and thoughts.
FuDDx
How do archons sleep?
8882
James Bond movies ranking - pa…
Topin
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2241 users

The Big Programming Thread - Page 211

Forum Index > General Forum
Post a Reply
Prev 1 209 210 211 212 213 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.
infinity21 *
Profile Blog Joined October 2006
Canada6683 Posts
December 06 2012 21:24 GMT
#4201
On December 07 2012 04:44 RoyGBiv_13 wrote:
Show nested quote +
On December 06 2012 14:50 infinity21 wrote:
Thanks guys. I'm not in any rush so I'll just take it slowly and explore what's been done in the area.
I'm not sure what coding these data structures involves but on a high level, I essentially only need to do matrix multiplication and loops (albeit a lot of them). Not sure how much complexity CUDA will add to the equation but I'm hoping it's not too much lol



I'll take a jab at your design since I once did something similar in an FPGA (drool, infinitely parallel computations makes neural nets fun and easy )

For matrix multiplication, take a look at SO for suggestions of a fast library: http://stackoverflow.com/questions/2637249/whats-a-good-matrix-manipulation-library-available-for-c

Theres a suggestion specific to CUDA: https://developer.nvidia.com/cublas Looks like those libraries are probably the best.

Though what people say about needing to know a ton about memory allocations and data structures to write good code in C is true, you should never reinvent the wheel. A fantastic programmer would know exactly how the data structures are implemented within the library code in order to best accommodate it within their own code (for example, lookup times in a certain table may be fast, but adding something is slow, so you would add everything in the table at the beginning and modify values as you see fit). This is true of all languages though.

For your system, you can trial and error your way to a workable code base without having to know everything about C and data structures. Honestly, as long as it runs, then you have written 'good' C code.

I'm not sure exactly what machine learning model you want to use for your system, so I'll let you find the library for that yourself.

In any case, please do take your time in tackling this Just don't stress about the language part of it. C is pretty easy to pick up and use, but incredibly difficult to master, like most things in computers/life.


I'll look into those links, thanks! My main motivation for using CUDA is for training deep neural nets and other variants of neural networks. There's just not enough computing power using a CPU even for small problems so I'm trying to use CUDA to speed up learning
Official Entusman #21
3FFA
Profile Blog Joined February 2010
United States3931 Posts
Last Edited: 2012-12-06 21:45:57
December 06 2012 21:44 GMT
#4202
What are the different things I can do with printf in C?

By this I mean what if I want to make a list of things align in a certain way like:

1 2 3
4 5 6
7 8 9

Is there any way to do this without a bunch of spaces and /n's? (may have chosen wrong slash)
Is there away to align the 1 to the left, the 2 to the center, and the 3 to the right etc.?
"As long as it comes from a pure place and from a honest place, you know, you can write whatever you want."
tofucake
Profile Blog Joined October 2009
Hyrule19189 Posts
December 06 2012 21:47 GMT
#4203
foreach(i = 1; i < 10; i++) {
stdout << i << ' ';
if(i % 3 == 0) cout << endl;
}


pretty basic
Liquipediaasante sana squash banana
adwodon
Profile Blog Joined September 2010
United Kingdom592 Posts
Last Edited: 2012-12-06 22:12:07
December 06 2012 22:02 GMT
#4204
for ( i = 1; i < 10; i+3 )
{
printf ( "%d %d %d\n", i, i+1, i+2 );
}


would be better?

maybe something like:

for ( i = 1; i < 10; i+3 )
{
printf ( "%d%3d%3d\n", i, i+1, i+2 );
}


but im not entirely sure if thats correct though, give it a try, to my knowledge you can't 'align' something to the left or right, and newlines are only from \n.
adwodon
Profile Blog Joined September 2010
United Kingdom592 Posts
Last Edited: 2012-12-06 22:03:12
December 06 2012 22:02 GMT
#4205
sorry double
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2012-12-06 22:05:48
December 06 2012 22:03 GMT
#4206
On December 07 2012 06:44 3FFA wrote:
What are the different things I can do with printf in C?

By this I mean what if I want to make a list of things align in a certain way like:

1 2 3
4 5 6
7 8 9

Is there any way to do this without a bunch of spaces and /n's? (may have chosen wrong slash)
Is there away to align the 1 to the left, the 2 to the center, and the 3 to the right etc.?


Take a look at http://www.cplusplus.com/reference/cstdio/printf/. I'm not sure centering text is available. What you're talking about is padding, I think, which is doable but only with 0s I think. The %d is where you can specify the formatting that you want for the string.

tofu's reference is about C++, not C. You guys are sorta missing the point. :s
There is no one like you in the universe.
Mstring
Profile Joined September 2011
Australia510 Posts
December 06 2012 22:39 GMT
#4207
There's no reason (IMO) to use C over C++ unless you have strict hardware limitations or are writing a seriously trivial program. C++ takes C's memory management to a new level. Deterministic destruction --the fact that the language makes guarantees about object lifetimes-- leads to some ridiculous powerful ideas, RAII being the core one. Not everyone's cup of tea, and not a beginner's solution, but definitely something to look into if you're not fully satisfied with the solutions that C offers (i.e. nothing but floating mallocs and frees).
phar
Profile Joined August 2011
United States1080 Posts
Last Edited: 2012-12-07 06:55:16
December 07 2012 06:52 GMT
#4208
On December 07 2012 07:03 Blisse wrote:
Show nested quote +
On December 07 2012 06:44 3FFA wrote:
What are the different things I can do with printf in C?

By this I mean what if I want to make a list of things align in a certain way like:

1 2 3
4 5 6
7 8 9

Is there any way to do this without a bunch of spaces and /n's? (may have chosen wrong slash)
Is there away to align the 1 to the left, the 2 to the center, and the 3 to the right etc.?


Take a look at http://www.cplusplus.com/reference/cstdio/printf/. I'm not sure centering text is available. What you're talking about is padding, I think, which is doable but only with 0s I think. The %d is where you can specify the formatting that you want for the string.

Space padding is default, you have to actually add the "0" in to make it pad 0s.


edit: "drop in" is probably ambiguous wording, I mean you have to do

%02d to make it print "02", if you don't add the 0 flag (%2d) you get space padding, the default.
Who after all is today speaking about the destruction of the Armenians?
RoyGBiv_13
Profile Blog Joined August 2010
United States1275 Posts
Last Edited: 2012-12-07 07:24:50
December 07 2012 07:08 GMT
#4209
On December 07 2012 07:39 Mstring wrote:
There's no reason (IMO) to use C over C++ unless you have strict hardware limitations or are writing a seriously trivial program. C++ takes C's memory management to a new level. Deterministic destruction --the fact that the language makes guarantees about object lifetimes-- leads to some ridiculous powerful ideas, RAII being the core one. Not everyone's cup of tea, and not a beginner's solution, but definitely something to look into if you're not fully satisfied with the solutions that C offers (i.e. nothing but floating mallocs and frees).


Linus has something to say about this:
http://article.gmane.org/gmane.comp.version-control.git/57918

Furthermore, from the compiler angle, C++ is an absolutely insane language. Just terrifying things can go wrong that you just can't diagnose. The object model and templates create some gnarly black magic in between the code you write and the machine code. Not to mention exception handling... At least, whenever you run across a difficult to design program in pure C, it is usually quick and simple to debug. The trade-off is that it's harder to design just about anything in pure C;

Note that I don't share Linus's views on the language itself. The design behind C++ is completely brilliant, and Stroustrup should win a Nobel Prize.

Its worth talking about the bad parts of adding features into a language along with the added benefit of simpler design concepts and useful guarantees. To each his own though...
Any sufficiently advanced technology is indistinguishable from magic
Mstring
Profile Joined September 2011
Australia510 Posts
Last Edited: 2012-12-07 09:38:45
December 07 2012 08:53 GMT
#4210
It sounds like Linus primarily has some beef with a particular way people use C++. If C++ had to be the way he describes, I'd be frustrated too. Thing is, not everyone who writes C++ code uses a "real database", "nice object-oriented libraries", or "nice C++ abstractions". Not everyone who writes C++ code is ignorant to the "low-level issues", and not everyone who writes C++ code develops an "object model".

I'm not attached to any particular paradigm but I know the attitude that Linus is talking about; the ignorantly dogmatic one. Objected oriented for the sake of it; because you were taught that it was good; because your boss tells you to do it; etc...

"In other words, the only way to do good, efficient, and system-level and portable C++ ends up to limit yourself to all the things that are basically available in C"

I'm advocating exactly this: less is more. I think that if Linus had taken his chill pill for the day we could sit down and agree on quite a lot xD

Imagine an old carbureted V8. I just want to do some bolt on mods and switch the ignition and fuel injection to electronic. Linus makes it sound like you have no option but to scrap the whole car and buy a brand new one. I guess I should sympathise; it sounds like he has been bittered by so many people buying the newest model that he's forgotten you can even modify the classics.

--

What concerns you about some of the gnarls? Templates are quite gnarly indeed-- I usually find myself using them only in standard containers. Virtual functions are full of black magic but you don't have to use inheritance. I never do.

Can you give an example of something terrifying going so wrong that it can't be diagnosed?
heishe
Profile Blog Joined June 2009
Germany2284 Posts
Last Edited: 2012-12-07 10:25:55
December 07 2012 10:16 GMT
#4211
Linus has to say a lot of things about a lot of stuff, and he's wrong about a lot of it. He's just a loudmouth who doesn't hold back when it comes to shouting his opinions.

Nobody who knows what they're talking about will ever make the argument to you that you should use C over C++ in a big project that doesn't have certain hardware or code safety restrictions (this might happen in fields like medicine, aviation, etc.). If anyone ever does, it's a C fanboy, C++ hater, or they genuinely believe what they say is objectively correct and they just don't have a clue.

And even if you have hardware-limitations or something like that, I'd argue that you should still use C++. Just don't use C++ with lots of inheritance and exceptions, or big classes which do a lot of things in memory that nobody knows about. Instead program C and add features where you deem reasonable, such as templates, better memory management and so forth, because a lot of things that C++ adds requires exactly 0 additional memory or runtime overhead compared to C, but makes programming a lot easier.

But then again, I'm not even sure if C++ compilers are available for all the C-centric platforms out there (e.g. microcontrollers and their different processor architectures which are used literally everywhere).

The same goes up the chain. Nobody who knows what they're talking about will ever make the point to you that you should use C++ over Java/C# in a big project that doesn't have certain hardware (e.g. execution time in games) or platform restrictions, and so forth.
If you value your soul, never look into the eye of a horse. Your soul will forever be lost in the void of the horse.
Schokomuesli
Profile Joined November 2010
Germany12 Posts
December 07 2012 11:14 GMT
#4212
About learning C++: http://abstrusegoose.com/249
;-)

I think this: http://simpleprogrammer.com/2012/12/01/why-c-is-not-back/ expands beautifully on heishe's post above (it's not as negative as the title may sound like...). I think that nowadays most poeple who use C++ (in "real" projects, that is: a team of people working on a big amount of code for a long time) do it for two reasons:

1. because they have very clear performance requirements regarding runtime behaviour, memory consumption or they have a certain set or regulations regarding usage of a non-garbage-collected and strongly-typed language etc. (e.g. software for nuclear power plants has those constraints among others) or

2. they work on a large set of legacy code they feel they cannot live without or are not willing to port to a language that is easier to handle.

If I would start a part-time project right now I do not think I would choose C++ even for server-side/performance-heavy programming. Even with C++ being the language I am most fluent with I think it's too overloaded with functionality and stuff-you-need-to-know-to-get-things-right to be of any use in a project which does not fall into the categories above. If I had to choose for this I think I would recommend go (golang.org) instead.

Regarding learning a language to get started: I would advise to start with something (relatively) easy like Python or maybe Ruby (no actual experiences there, though). Don't bother with a book; there are really good online courses (http://learnpythonthehardway.org/ is _really_ neat since besides teaching basic programming it also conveys very nicely a good mindset for programming IMHO). Get good with using google and good reference / QA-sites (stackoverflow comes to mind here) when you run into problems (after a while you can structure your searches so you find your answers in one of the results on the first page, don't know how to explain but after a while it just works :-)).

After having worked throughout the book/online course/whatever, look for a small task to build a program for. Nothing fancy (that is: no gaming/video/3D, no heavy networking etc...), think of something you missed on your computer once or twice and build it. This should not exceed some thousand lines maybe. Just make it work in the first place and try to remember the things that were hard for you (keep notes if you can't remember). Then build it again from scratch and compare your old with your new code if you like; you _will_ see an improvement there. Read code by other people (for example on github) and try to understand what they are doing and why they are doing it the way they do.

If you are done with this try to switch languages (say to C# or Java for example). If you want to hurt yourself switch to C++
akarin
Profile Joined February 2011
Ireland42 Posts
December 07 2012 11:14 GMT
#4213
Hey guys

Anyone here that could help me with a small bit of assembly language through skype? It would be super appreciated <3
heishe
Profile Blog Joined June 2009
Germany2284 Posts
December 07 2012 18:31 GMT
#4214
On December 07 2012 20:14 akarin wrote:
Hey guys

Anyone here that could help me with a small bit of assembly language through skype? It would be super appreciated <3


Not through skype. Better just post it here, written advice is better for that kind of stuff anyways.
If you value your soul, never look into the eye of a horse. Your soul will forever be lost in the void of the horse.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
December 07 2012 18:37 GMT
#4215
Maybe he means through Skype messenger XD

And just because Linus has done a lot for computer science doesn't make his opinions true or more relevant than others.


Also, I hate learning Go. As much as it's painful to say this, but I NEED SEMICOLONS FUUU. It feels so wrong writing lines without semi-colons, and I hate using gofmt to reformat my code.
There is no one like you in the universe.
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
December 07 2012 18:58 GMT
#4216
On December 08 2012 03:37 Blisse wrote:
Maybe he means through Skype messenger XD

And just because Linus has done a lot for computer science doesn't make his opinions true or more relevant than others.


Also, I hate learning Go. As much as it's painful to say this, but I NEED SEMICOLONS FUUU. It feels so wrong writing lines without semi-colons, and I hate using gofmt to reformat my code.


Yeah, Linus is a great guy but his opinions about programming are often very... controversial. I find myself to often disagree with his opinions, he sounds like someone who was burnt by poor OOP one time too much and now thinks all the modern techniques are always bad.
jjwhg
Profile Blog Joined October 2012
United States155 Posts
December 07 2012 21:01 GMT
#4217
On December 08 2012 03:31 heishe wrote:
Show nested quote +
On December 07 2012 20:14 akarin wrote:
Hey guys

Anyone here that could help me with a small bit of assembly language through skype? It would be super appreciated <3


Not through skype. Better just post it here, written advice is better for that kind of stuff anyways.


I'm new around here, but wouldn't the IRC channel (#tl.code, see the OP) be a better place than Skype for something like this? Sometimes it's nice to be able to communicate in real-time.


I'll be idling there for a few hours if you still want some help.
♥ Bisu ♥
adwodon
Profile Blog Joined September 2010
United Kingdom592 Posts
December 07 2012 21:03 GMT
#4218
“I've come up with a set of rules that describe our reactions to technologies:
1. Anything that is in the world when you’re born is normal and ordinary and is just a natural part of the way the world works.
2. Anything that's invented between when you’re fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it.
3. Anything invented after you're thirty-five is against the natural order of things.”
― Douglas Adams, The Salmon of Doubt


Linus reminds me of this.
phar
Profile Joined August 2011
United States1080 Posts
December 07 2012 23:28 GMT
#4219
On December 08 2012 03:37 Blisse wrote:I hate using gofmt to reformat my code.

Uniformly formatted code is a fucking godsend for large codebases though. Keep in mind who wrote the language, and what their purposes are.
Who after all is today speaking about the destruction of the Armenians?
Craton
Profile Blog Joined December 2009
United States17274 Posts
December 08 2012 00:14 GMT
#4220
Oracle SQL Developer really needs a refactor button. I'm using a hackish notepad++ solution for it right now.
twitch.tv/cratonz
Prev 1 209 210 211 212 213 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 27m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
mouzHeroMarine 646
IndyStarCraft 198
JuggernautJason36
Vindicta 32
StarCraft: Brood War
Calm 2276
Shuttle 696
Mini 35
910 29
Movie 17
Dota 2
Gorgc7555
qojqva3522
Counter-Strike
fl0m2838
byalli2165
Heroes of the Storm
Liquid`Hasu384
Other Games
FrodaN6971
Grubby3640
Liquid`RaSZi2668
summit1g2611
B2W.Neo943
crisheroes372
Harstem280
ToD194
ArmadaUGS145
Mew2King17
mouzStarbuck15
Railgan1
Organizations
Other Games
gamesdonequick2566
StarCraft 2
ComeBackTV 1547
Other Games
EGCTV1247
StarCraft 2
angryscii 22
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• HeavenSC 31
• Reevou 3
• Kozan
• Laughngamez YouTube
• sooper7s
• AfreecaTV YouTube
• intothetv
• Migwel
• IndyKCrew
• LaughNgamezSOOP
StarCraft: Brood War
• FirePhoenix13
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
League of Legends
• Jankos3018
• TFBlade899
Other Games
• imaqtpie2278
• Shiphtur268
Upcoming Events
BSL 21
27m
Bonyth vs Sziky
Mihu vs QiaoGege
Sziky vs XuanXuan
eOnzErG vs QiaoGege
Mihu vs DuGu
Dewalt vs Bonyth
IPSL
27m
Dewalt vs Sziky
Replay Cast
13h 27m
Wardi Open
16h 27m
Monday Night Weeklies
21h 27m
OSC
1d 15h
The PondCast
2 days
OSC
2 days
Big Brain Bouts
4 days
Serral vs TBD
BSL 21
5 days
[ Show More ]
BSL 21
6 days
Liquipedia Results

Completed

Escore Tournament S1: W4
Big Gabe Cup #3
NA Kuram Kup

Ongoing

C-Race Season 1
IPSL Winter 2025-26
BSL 21 Non-Korean Championship
CSL 2025 WINTER (S19)
KCM Race Survival 2026 Season 1
OSC Championship Season 13
Underdog Cup #3
BLAST Bounty Winter Qual
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025

Upcoming

Escore Tournament S1: W5
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Rongyi Cup S3
Nations Cup 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 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.