• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 04:11
CEST 10:11
KST 17:11
  • 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] Ro24 Preview Pt2: News Flash8[ASL21] Ro24 Preview Pt1: New Chaos0Team Liquid Map Contest #22 - Presented by Monster Energy16ByuL: The Forgotten Master of ZvT30Behind the Blue - Team Liquid History Book20
Community News
Weekly Cups (March 23-29): herO takes triple6Aligulac acquired by REPLAYMAN.com/Stego Research8Weekly Cups (March 16-22): herO doubles, Cure surprises3Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool49Weekly Cups (March 9-15): herO, Clem, ByuN win4
StarCraft 2
General
Team Liquid Map Contest #22 - Presented by Monster Energy Aligulac acquired by REPLAYMAN.com/Stego Research Weekly Cups (March 23-29): herO takes triple What mix of new & old maps do you want in the next ladder pool? (SC2) herO wins SC2 All-Star Invitational
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament RSL Season 4 announced for March-April StarCraft Evolution League (SC Evo Biweekly) WardiTV Mondays World University TeamLeague (500$+) | Signups Open
Strategy
Custom Maps
[M] (2) Frigid Storage Publishing has been re-enabled! [Feb 24th 2026]
External Content
Mutation # 519 Inner Power The PondCast: SC2 News & Results Mutation # 518 Radiation Zone Mutation # 517 Distant Threat
Brood War
General
ASL21 General Discussion BGH Auto Balance -> http://bghmmr.eu/ Behind the scenes footage of ASL21 Group E A cwal.gg Extension - Easily keep track of anyone BW General Discussion
Tourneys
[ASL21] Ro24 Group F [ASL21] Ro24 Group E Azhi's Colosseum - Foreign KCM 🌍 Weekly Foreign Showmatches
Strategy
Fighting Spirit mining rates What's the deal with APM & what's its true value Simple Questions, Simple Answers
Other Games
General Games
EZG.com Mega Sale: ARC Raiders Flashpoint Blueprin Stormgate/Frost Giant Megathread Nintendo Switch Thread Starcraft Tabletop Miniature Game General RTS Discussion Thread
Dota 2
The Story of Wings Gaming Official 'what is Dota anymore' discussion
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
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread Canadian Politics Mega-thread Things Aren’t Peaceful in Palestine The Games Industry And ATVI European Politico-economics QA Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! [Req][Books] Good Fantasy/SciFi books
Sports
2024 - 2026 Football Thread Formula 1 Discussion Cricket [SPORT] Tokyo Olympics 2021 Thread General nutrition recommendations
World Cup 2022
Tech Support
[G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Funny Nicknames
LUCKY_NOOB
Money Laundering In Video Ga…
TrAiDoS
Iranian anarchists: organize…
XenOsky
FS++
Kraekkling
Shocked by a laser…
Spydermine0240
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 12375 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
Hyrule19200 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 States17281 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 1h 50m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Codebar 37
StarCraft: Brood War
BeSt 117
Sharp 44
Leta 43
Mini 35
NotJumperer 28
Soma 24
ajuk12(nOOB) 19
yabsab 15
soO 14
Dota 2
XaKoH 68
League of Legends
JimRising 559
Counter-Strike
Stewie2K1047
Other Games
ceh9516
Happy244
C9.Mang0201
NeuroSwarm121
Organizations
Other Games
gamesdonequick656
BasetradeTV77
StarCraft: Brood War
UltimateBattle 48
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Berry_CruncH333
• LUISG 31
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• iopq 3
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos614
Upcoming Events
RSL Revival
1h 50m
TriGGeR vs Cure
ByuN vs Rogue
Big Brain Bouts
7h 50m
TriGGeR vs Lambo
Replay Cast
15h 50m
RSL Revival
1d 1h
Maru vs MaxPax
BSL
1d 10h
RSL Revival
1d 22h
uThermal 2v2 Circuit
2 days
BSL
2 days
Afreeca Starleague
3 days
Wardi Open
3 days
[ Show More ]
Replay Cast
3 days
Sparkling Tuna Cup
4 days
The PondCast
6 days
Replay Cast
6 days
Liquipedia Results

Completed

CSL Season 20: Qualifier 1
WardiTV Winter 2026
NationLESS Cup

Ongoing

BSL Season 22
CSL Elite League 2026
ASL Season 21
CSL Season 20: Qualifier 2
Escore Tournament S2: W1
StarCraft2 Community Team League 2026 Spring
RSL Revival: Season 4
Nations Cup 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
IEM Kraków 2026
BLAST Bounty Winter 2026

Upcoming

CSL 2026 SPRING (S20)
Acropolis #4
IPSL Spring 2026
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
IEM Rio 2026
PGL Bucharest 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.