• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 13:57
CEST 19:57
KST 02:57
  • 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
[ASL20] Ro8 Preview Pt1: Mile High3Team TLMC #5 - Finalists & Open Tournaments2[ASL20] Ro16 Preview Pt2: Turbulence10Classic Games #3: Rogue vs Serral at BlizzCon10[ASL20] Ro16 Preview Pt1: Ascent10
Community News
StarCraft II 5.0.15 PTR Patch Notes186BSL 2025 Warsaw LAN + Legends Showmatch2Weekly Cups (Sept 8-14): herO & MaxPax split cups4WardiTV TL Team Map Contest #5 Tournaments1SC4ALL $6,000 Open LAN in Philadelphia8
StarCraft 2
General
StarCraft II 5.0.15 PTR Patch Notes Why Storm Should NOT Be Nerfed – A Core Part of Pr #1: Maru - Greatest Players of All Time SC4ALL: A North American StarCraft LAN Team TLMC #5 - Finalists & Open Tournaments
Tourneys
SC2's Safe House 2 - October 18 & 19 RSL: Revival, a new crowdfunded tournament series Stellar Fest KSL Week 80 StarCraft Evolution League (SC Evo Biweekly)
Strategy
Custom Maps
External Content
Mutation # 491 Night Drive Mutation # 490 Masters of Midnight Mutation # 489 Bannable Offense Mutation # 488 What Goes Around
Brood War
General
[ASL20] Ro8 Preview Pt1: Mile High BGH Auto Balance -> http://bghmmr.eu/ ASL ro8 Upper Bracket HYPE VIDEO BW General Discussion StarCraft Stellar Forces had bad maps
Tourneys
SC4ALL $1,500 Open Bracket LAN [ASL20] Ro16 Group D BSL 2025 Warsaw LAN + Legends Showmatch [ASL20] Ro16 Group C
Strategy
Simple Questions, Simple Answers Muta micro map competition
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Path of Exile Borderlands 3 General RTS Discussion Thread
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread The Big Programming Thread UK Politics Mega-thread
Fan Clubs
The Happy Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023
World Cup 2022
Tech Support
Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread High temperatures on bridge(s)
TL Community
BarCraft in Tokyo Japan for ASL Season5 Final The Automated Ban List
Blogs
The Dark Side of South Kore…
Peanutsc
Too Many LANs? Tournament Ov…
TrAiDoS
I <=> 9
KrillinFromwales
A very expensive lesson on ma…
Garnet
hello world
radishsoup
Lemme tell you a thing o…
JoinTheRain
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2261 users

The Big Programming Thread - Page 829

Forum Index > General Forum
Post a Reply
Prev 1 827 828 829 830 831 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.
Hanh
Profile Joined June 2016
146 Posts
January 19 2017 02:10 GMT
#16561
Virtual dispatch is slower in many cases. Consider that an indirect call cannot be predicted nor inlined. Some benchmarks have found a difference of 7 x in favor of static calls.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
January 19 2017 03:29 GMT
#16562
--- Nuked ---
Svazila
Profile Joined January 2017
1 Post
January 19 2017 05:21 GMT
#16563
--- Nuked ---
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2017-01-19 07:34:07
January 19 2017 07:30 GMT
#16564
On January 19 2017 12:29 Nesserev wrote:
Started reading the 'Modern C' book that was linked by Biolunar + Show Spoiler [a few pages back] +
On January 03 2017 20:37 Biolunar wrote:
Show nested quote +
On January 03 2017 00:20 Silvanel wrote:
What resources would You guys recommend to someone trying to learn C ?

This might be too hard if you have no programming experience, but if you do, use this:
http://icube-icps.unistra.fr/index.php/File:ModernC.pdf
This book focuses on how to avoid many of C’s pitfalls and teaches many good habits that are not possible in older versions of the language.

.
What's your opinion on using the 'array notation' for passing arrays as arguments to functions in C/C++?

On page 13-14, the book recommends the array notation, naming readability and (what comes down to) documentation as reasons. On the other hand, it obfuscates what's really going on (it's just a pointer in the end, and you probably need to pass an extra size_t anyway), and seems to lead to obscure/hard-to-find bugs.

Anything I missed?


Not always right to quote Linus but here's his thoughts.

https://lkml.org/lkml/2015/9/3/428


static bool rate_control_cap_mask(struct ieee80211_sub_if_data *sdata,
struct ieee80211_supported_band *sband,
struct ieee80211_sta *sta, u32 *mask,
u8 mcs_mask[IEEE80211_HT_MCS_MASK_LEN])

...

for (i = 0; i < sizeof(mcs_mask); i++)

the "sizeof(mcs_mask)" is _shit_. Since array arguments don't actually
exist in C, it is the size of the pointer, not the array. The first
mistake makes the bug look like reasonable code.

...

I realy want people to take a really hard look at functions that use
arrays as arguments. It really is very misleading, even if it can look
"prettier", and some people will argue that it's "documentation" about
how the pointer is a particular size. But it's neither. It's basically
just lying about what is going on, and the only thing it documents is
"I don't know how to C". Misleading documentation isn't documentation,
it's a mistake.


I've never seen the array notation in production code so I'd never use it. My coding conventions and/or abstractions make it clear enough what's going on, i.e. arr and arrLength as param names, or passing structs with size members.
There is no one like you in the universe.
Biolunar
Profile Joined February 2012
Germany224 Posts
Last Edited: 2017-01-19 11:32:50
January 19 2017 11:30 GMT
#16565
On January 19 2017 12:29 Nesserev wrote:
Started reading the 'Modern C' book that was linked by Biolunar + Show Spoiler [a few pages back] +
On January 03 2017 20:37 Biolunar wrote:
Show nested quote +
On January 03 2017 00:20 Silvanel wrote:
What resources would You guys recommend to someone trying to learn C ?

This might be too hard if you have no programming experience, but if you do, use this:
http://icube-icps.unistra.fr/index.php/File:ModernC.pdf
This book focuses on how to avoid many of C’s pitfalls and teaches many good habits that are not possible in older versions of the language.

.
What's your opinion on using the 'array notation' for passing arrays as arguments to functions in C/C++?

On page 13-14, the book recommends the array notation, naming readability and (what comes down to) documentation as reasons. On the other hand, it obfuscates what's really going on (it's just a pointer in the end, and you probably need to pass an extra size_t anyway), and seems to lead to obscure/hard-to-find bugs.

Anything I missed?

Every C programmer should know what array to pointer decay is. Array notations in function declarations are just eye candy. Just follow your own intuition.

I am starting to use the following convention:
  • void foo(T param[static 1]); for functions that take exactly one parameter as a pointer
  • void foo(T* param); for functions that take exactly one parameter as a pointer or a null pointer
  • void foo(T param[static N], size_t count); for functions that take at least N parameters, where N is an integral constant expression

That book also uses VLAs for array parameters which I don’t use. Ever.
What is best? To crush the Zerg, see them driven before you, and hear the lamentations of the Protoss.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
January 19 2017 18:31 GMT
#16566
On January 19 2017 11:10 Hanh wrote:
Virtual dispatch is slower in many cases. Consider that an indirect call cannot be predicted nor inlined. Some benchmarks have found a difference of 7 x in favor of static calls.

Of course a virtual dispatch is slower than a static call. But virtual dispatch is not necessarily slower than a conditional. Especially if there are many branches or the comparision is complex, like a string comparision.
If you have a good reason to disagree with the above, please tell me. Thank you.
Hanh
Profile Joined June 2016
146 Posts
January 20 2017 00:30 GMT
#16567
I was not talking about a dumb static call but static dispatch. Some compilers actually implement 'devirtualization' for this reason.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2017-01-20 04:03:42
January 20 2017 00:43 GMT
#16568
On January 19 2017 20:30 Biolunar wrote:
Show nested quote +
On January 19 2017 12:29 Nesserev wrote:
Started reading the 'Modern C' book that was linked by Biolunar + Show Spoiler [a few pages back] +
On January 03 2017 20:37 Biolunar wrote:
Show nested quote +
On January 03 2017 00:20 Silvanel wrote:
What resources would You guys recommend to someone trying to learn C ?

This might be too hard if you have no programming experience, but if you do, use this:
http://icube-icps.unistra.fr/index.php/File:ModernC.pdf
This book focuses on how to avoid many of C’s pitfalls and teaches many good habits that are not possible in older versions of the language.

.
What's your opinion on using the 'array notation' for passing arrays as arguments to functions in C/C++?

On page 13-14, the book recommends the array notation, naming readability and (what comes down to) documentation as reasons. On the other hand, it obfuscates what's really going on (it's just a pointer in the end, and you probably need to pass an extra size_t anyway), and seems to lead to obscure/hard-to-find bugs.

Anything I missed?

Every C programmer should know what array to pointer decay is. Array notations in function declarations are just eye candy. Just follow your own intuition.

I am starting to use the following convention:
  • void foo(T param[static 1]); for functions that take exactly one parameter as a pointer
  • void foo(T* param); for functions that take exactly one parameter as a pointer or a null pointer
  • void foo(T param[static N], size_t count); for functions that take at least N parameters, where N is an integral constant expression

That book also uses VLAs for array parameters which I don’t use. Ever.


The problem with the static keyword and the array notation is it still looks like sizeof(param) will return N instead of sizeof(T*), even if you're familiar with the array decay. In C I think it's super important to practice defensive programming, which is to avoid situations like this, as per the Linus example I linked previously.

Or I may be misreading your convention, in which case why use a param array instead of the param directly? I've never seen a param array like that. That looks like a typecasting error prone nightmare?
There is no one like you in the universe.
BlueRoyaL
Profile Blog Joined February 2006
United States2493 Posts
January 20 2017 05:57 GMT
#16569
Hey guys, I have a (semi) silly question, just want to get your opinions.

I've been thinking of starting to blog again about programming stuff. I had set one up a couple years ago that's titled "Finally Working", with the sub text "thank god it compiled".

At the time I thought it was funny, and i wouldnt mind continuing to use it. But from your professional standpoint, does it seem a little weird or offsetting? As in, if you were some recruiter and happened to be on the page, would it bother you that the creator used the line "thank god it compiled", possibly indicating some level of ineptitude in programming?

I might just be overthinking this, any thoughts?
WHAT'S HAPPENIN
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
January 20 2017 07:22 GMT
#16570
On January 20 2017 14:57 BlueRoyaL wrote:
Hey guys, I have a (semi) silly question, just want to get your opinions.

I've been thinking of starting to blog again about programming stuff. I had set one up a couple years ago that's titled "Finally Working", with the sub text "thank god it compiled".

At the time I thought it was funny, and i wouldnt mind continuing to use it. But from your professional standpoint, does it seem a little weird or offsetting? As in, if you were some recruiter and happened to be on the page, would it bother you that the creator used the line "thank god it compiled", possibly indicating some level of ineptitude in programming?

I might just be overthinking this, any thoughts?


In my opinion no one would care if you had more than 3 non-insignificant blog posts.
There is no one like you in the universe.
RoomOfMush
Profile Joined March 2015
1296 Posts
January 20 2017 10:26 GMT
#16571
On January 20 2017 14:57 BlueRoyaL wrote:
Hey guys, I have a (semi) silly question, just want to get your opinions.

I've been thinking of starting to blog again about programming stuff. I had set one up a couple years ago that's titled "Finally Working", with the sub text "thank god it compiled".

At the time I thought it was funny, and i wouldnt mind continuing to use it. But from your professional standpoint, does it seem a little weird or offsetting? As in, if you were some recruiter and happened to be on the page, would it bother you that the creator used the line "thank god it compiled", possibly indicating some level of ineptitude in programming?

I might just be overthinking this, any thoughts?

I wouldnt care. But how useful this information is to you I dont know.
Acrofales
Profile Joined August 2010
Spain18055 Posts
January 20 2017 10:39 GMT
#16572
On January 20 2017 14:57 BlueRoyaL wrote:
Hey guys, I have a (semi) silly question, just want to get your opinions.

I've been thinking of starting to blog again about programming stuff. I had set one up a couple years ago that's titled "Finally Working", with the sub text "thank god it compiled".

At the time I thought it was funny, and i wouldnt mind continuing to use it. But from your professional standpoint, does it seem a little weird or offsetting? As in, if you were some recruiter and happened to be on the page, would it bother you that the creator used the line "thank god it compiled", possibly indicating some level of ineptitude in programming?

I might just be overthinking this, any thoughts?

If your blog is useful, the title doesn't matter. If your blog is useless/bad, the least you have to worry about is choosing a funny title.

In other words, if your blog sucks, don't show it to your future employer. If it is good, add it to your CV. In either case, don't worry about the title.
Djagulingu
Profile Blog Joined December 2010
Germany3605 Posts
Last Edited: 2017-01-20 12:47:09
January 20 2017 12:46 GMT
#16573
On January 20 2017 14:57 BlueRoyaL wrote:
Hey guys, I have a (semi) silly question, just want to get your opinions.

I've been thinking of starting to blog again about programming stuff. I had set one up a couple years ago that's titled "Finally Working", with the sub text "thank god it compiled".

At the time I thought it was funny, and i wouldnt mind continuing to use it. But from your professional standpoint, does it seem a little weird or offsetting? As in, if you were some recruiter and happened to be on the page, would it bother you that the creator used the line "thank god it compiled", possibly indicating some level of ineptitude in programming?

I might just be overthinking this, any thoughts?

Yes you're overthinking. As long as your content is halfway decent, the single worst thing the recruiter could think about that title is "Good thing this dude is not a comedian or some shit".
"windows bash is a steaming heap of shit" tofucake
Manit0u
Profile Blog Joined August 2004
Poland17350 Posts
January 20 2017 13:08 GMT
#16574
Will this blog be only about compiled languages?
Time is precious. Waste it wisely.
BlueRoyaL
Profile Blog Joined February 2006
United States2493 Posts
January 20 2017 16:00 GMT
#16575
On January 20 2017 22:08 Manit0u wrote:
Will this blog be only about compiled languages?


Not necessarily. I was mainly a sysadmin back when i created it, but since then i've pivoted and work as a dev on the full stack. There might occasionally be something about frontend stuff as well.
WHAT'S HAPPENIN
phar
Profile Joined August 2011
United States1080 Posts
January 20 2017 17:00 GMT
#16576
Is the title sort of sarcastically pointing out that cowboy coding and shipping shit as soon as it compiles causes people problems down the road (e.g. the poor saps on call)? If so I think it's a genius title if you can pull in some horror stories from sysadmin days when you got burned by that sort of thing.
Who after all is today speaking about the destruction of the Armenians?
Manit0u
Profile Blog Joined August 2004
Poland17350 Posts
January 24 2017 12:25 GMT
#16577
https://aturon.github.io/blog/2016/08/11/futures/

[image loading]

User was warned for this post
Time is precious. Waste it wisely.
Hanh
Profile Joined June 2016
146 Posts
January 25 2017 02:18 GMT
#16578
Yeah, it's amazing that someone can take something that was available for years and present it as new.
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
January 25 2017 11:45 GMT
#16579
On January 25 2017 11:18 Hanh wrote:
Yeah, it's amazing that someone can take something that was available for years and present it as new.


The whole programming sector ist moving in circles. Every few years a "new thing" appears, gets replaced by something better which gets replaced by something more advanced which then gets replaced by another "new Thing" - which is pretty much the same thing everything started with, just with a fancier name.

Programmers are experts in reinventing wheels and calling them "best new things that change everything".
Manit0u
Profile Blog Joined August 2004
Poland17350 Posts
January 25 2017 12:47 GMT
#16580
How can people work with white background in their IDE is beyond me...
Time is precious. Waste it wisely.
Prev 1 827 828 829 830 831 1032 Next
Please log in or register to reply.
Live Events Refresh
Online Event
16:00
PSC2L September 2025
CranKy Ducklings189
Liquipedia
BSL Open LAN 2025 - War…
08:00
Day 2 - Play Off & Finals Stage
ZZZero.O269
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
mouzHeroMarine 238
JuggernautJason182
StarCraft: Brood War
Sea 1361
Shuttle 1019
Larva 446
ZZZero.O 269
Mong 118
Movie 86
Dewaltoss 80
Backho 58
sorry 50
Aegong 42
[ Show more ]
Hyun 41
sas.Sziky 31
Free 28
IntoTheRainbow 12
Dota 2
Gorgc6755
qojqva4143
Dendi1582
XcaliburYe271
Counter-Strike
fl0m661
Stewie2K250
Heroes of the Storm
Khaldor269
Other Games
tarik_tv9577
FrodaN3883
Grubby1013
B2W.Neo586
KnowMe403
Mew2King101
NeuroSwarm56
QueenE47
MindelVK17
Organizations
Other Games
EGCTV1494
gamesdonequick545
StarCraft 2
angryscii 25
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• intothetv
• AfreecaTV YouTube
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• HerbMon 12
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• C_a_k_e 2816
Other Games
• imaqtpie551
• Shiphtur253
• WagamamaTV237
Upcoming Events
Afreeca Starleague
16h 3m
Barracks vs Mini
Wardi Open
17h 3m
Monday Night Weeklies
22h 3m
Sparkling Tuna Cup
1d 16h
Afreeca Starleague
1d 16h
Snow vs EffOrt
LiuLi Cup
2 days
The PondCast
3 days
CranKy Ducklings
4 days
Maestros of the Game
5 days
Clem vs Reynor
[BSL 2025] Weekly
6 days
[ Show More ]
[BSL 2025] Weekly
6 days
Liquipedia Results

Completed

Proleague 2025-09-18
Chzzk MurlocKing SC1 vs SC2 Cup #2
HCC Europe

Ongoing

BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
LASL Season 20
BSL World Championship of Poland 2025
RSL Revival: Season 2
Maestros of the Game
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1

Upcoming

IPSL Winter 2025-26
BSL Season 21
SC4ALL: Brood War
BSL 21 Team A
Stellar Fest
SC4ALL: StarCraft II
EC S1
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
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 © 2025 TLnet. All Rights Reserved.