• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 17:33
CET 23:33
KST 07:33
  • 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
Greatest Players of All Time: Addendum - Dark10Team Liquid Map Contest #2312[ASL22] Finals Preview: Sweet Victory!12[ASL22] Ro4 Preview: Mirror Mirror6[ASL22] Ro8 Preview: Within Reach5
Community News
[BSL23] ProLeague RO82Serral wins 2026 RSL Season Finals12Weekly Cups (Nov 16-22): MaxPax doubles, Dark heats up0BSL 2v2 ProLeague Season 44Weekly Cups (Nov 9-15): Clem and herO take over6
StarCraft 2
General
About rush maps Best SC2 Parody Song about 2v2? Greatest Players of All Time: Addendum - Dark Serral wins 2026 RSL Season Finals How do you feel about the mass reverts in the 5.0.17 PTR?
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament Kung Fu Cup - 2026 Grand Finals (Nov 24-29) RSL goes to London! 2026 Offline Finals Nov 21-22 soO & FanTaSy return! SC2 Kevin Scrim 4v4 (Nov 16) ISSL:Premier#2 Announcement
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 # 553 Undermined The PondCast: SC2 News & Results Mutation # 552 Secret Storm Mutation # 551 Robotic Revival
Brood War
General
List of top players active on ShieldBattery BW General Discussion New ASL23 Maps SOOP Announces New Women's Monthly Tournament screpdb: new Starcraft reporting tool
Tourneys
2v2v2v2 Tournament Stage 2: Players BSL 2v2 ProLeague Season 4 Ultimate Battle Event [BSL23] ProLeague RO8
Strategy
Request - 3-factory/fast timings as Terran Pluto's TvP 5Marine 2Medic Push Simple Questions, Simple Answers Infested Terran strategies in 2026
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread The PlayStation 5 Warcraft III: The Frozen Throne Free Space RTS Game, optimised f. Phone/Tablet etc
Dota 2
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
Artificial Intelligence Thread US Politics Mega-thread The Chess Thread The Games Industry And ATVI Russo-Ukrainian War Thread
Fan Clubs
INnoVation Fan Club Fan Club Resource Thread
Media & Entertainment
Anime Discussion Thread Movie Discussion!
Sports
Football (Soccer) Thread Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Recent Gifted Posts
Blogs
[Kickstarter] The Roman E…
LUCKY_NOOB
On Parallel Lives in Fascis…
p4NDemik
The time I organised my…
AssyrianKing
Why I built Repalyzer (1.1.…
BlueStar
Innovate or Game Over?
TrAiDoS
ShieldBattery on Mac
Kraekkling
James Bond movies ranking - pa…
Topin
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 13740 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
Hyrule19276 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 States17305 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
BSL
05:00
Bracket - Day 1
Ret vs TerrOr
UltrA vs Bonyth
ZZZero.O388
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
ForJumy 125
ProTech108
EmSc Tv 20
StarCraft: Brood War
ZZZero.O 388
Dota 2
syndereN521
PGG 185
League of Legends
Doublelift4338
Other Games
summit1g8229
tarik_tv4448
Grubby2495
Coldzera 782
PiGStarcraft418
Mew2King85
Organizations
Other Games
gamesdonequick1244
TaKeTV 92
StarCraft 2
EmSc Tv 20
[ Show 11 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV723
Other Games
• imaqtpie1099
• Shiphtur254
Upcoming Events
Kung Fu Cup
12h 27m
Solar vs Rogue
herO vs TBD
BSL
21h 27m
Kyrie vs JDConan
Dewalt vs eOnzErG
Replay Cast
1d
WardiTV Weekly
1d 13h
Ultimate Battle
1d 13h
Sparkling Tuna Cup
2 days
PiGosaur Cup
3 days
The PondCast
4 days
KCM Race Survival
4 days
Replay Cast
5 days
[ Show More ]
CranKy Ducklings
6 days
Liquipedia Results

Completed

Sijosae Cup
RSL Offline Finals
Underdog Cup 2026 Div 2-3

Ongoing

Acropolis #5
KCM Race Survival 2026 Season 4
International ShieldBattery League
BSL Season 23
IPSL Winter 2026-27
CSL Season 23: Qualifier 1
Sector 591
CSL Season 23: Qualifier 2
Kung Fu Cup 2026 Grand Finals
Calamity Cup Div. A Season 8
PGL Major Singapore 2026
Stake Ranked Episode 6
BLAST Rivals Fall 2026
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

Upcoming

YSL S4
SC4ALL II: Brood War
CSL 2026 Winter (S23) - 3v3
CSL 2026 Winter (S23)
NBSL 2026 Xiamen LAN
BSL 23: Non-Korean Championship
BSL 2v2 Season 4
HSC XXX
Stellar Fest 2: Lunar Cup
StarCraft2 Weekly Open Tournament 2026 Grand Finals
SC4ALL II: StarCraft II
IEM Kraków 2027
PGL Bucharest 2027
BLAST Bounty Winter 2027
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.