Religious technical opinions - Page 1
Forum section: electronics / general

author: Picuino
author_rank: Super Contributor
timestamp: February 19, 2022, 01:20:22 pm
content: It is curious how many technicians think about some banal and almost silly options in a quasi-religious way.For example I ALWAYS try to program with spaces instead of tabs. It could have been the other way around, but in the end I opted for the spaces and no one will change my mind. Programming with tabs is like a pain for me.The same thing happens many times with Vi and Emacs, Linux and Windows or other spurious options.It seems that people's minds are programmed to take sides and we think that it is the only true way of seeing things. That creates endless arguments that seem to go nowhere because both sides are convinced the other is wrong.That is so and we all assume it for political or religious opinions, but it never ceases to amaze me that it also occurs in things as banal as spaces and tabs.Regards.

author: eugene
author_rank: Frequent Contributor
timestamp: February 19, 2022, 01:23:15 pm
content: It's hard for me to take the video seriously when they're using Apple computers.EDIT:

author: NiHaoMike
author_rank: Super Contributor
timestamp: February 19, 2022, 01:49:08 pm
content: I think the preference for tabs over spaces was made popular by web developers, where back in the days, the difference would be a significant improvement in loading speed. Of course, it really began with the first programming language that could accept either tabs or spaces, back when storage was expensive and so every byte added up.

author: Siwastaja
author_rank: Super Contributor
timestamp: February 19, 2022, 01:54:32 pm
content: Quote from: Picuino on February 19, 2022, 01:20:22 pmRight there, you answered your own question without even realizing you asked that question!If programming with tabs is like pain for you, what happens if you pull a code file from a co worker, written with tabs, and need to work with that file together?It's pain to you: fortechnical, actualreasons: the fact you have learned to use spaces, like you learn to ride a bicycle, so tabs really work slower for you. Maybe the text editor of your choice works better with spaces, too.So it's not a meaningless thing, nor it's a religious thing, but a practical, actual one.For me, it's the opposite, I want the tabs, but the pain is exactly the same.Of course, now the big decision part is, are you going to be an asshole and start fighting about it, or accept the different viewpoint, slowing down your workflow, or try to work out some compromise.Many simply won't want to accept slowing down their work, because they think it is important. While a bit selfish, this is also natural and understandable.Finally, the deciding factor again is, not religion, but actual engineering question: the choice of text editor and its configuration. It either makes or breaks the usage of spaces or tabs.So sorry, I don't agree; this isn't a religious technical opinion, but an actual technical one. The fact that personal learning process is part of that technicality, and you could have ended up either way, does not make it religious.

author: cgroen
author_rank: Unknown
timestamp: February 19, 2022, 02:06:40 pm
content: Quote from: Siwastaja on February 19, 2022, 01:54:32 pmTotally agree!I used to be a "space guy" (for more than 20 years), 16 years ago I "converted" to tab in all software I write (which is a lot), this is across many different tools, for me this has been so much easier!Nothing to do with "religion".

author: Siwastaja
author_rank: Super Contributor
timestamp: February 19, 2022, 02:35:47 pm
content: I also used spaces because the software I learnt to write code in, MS-DOS 6.22EDIT, inserted 4 spaces by press of tab, by default, if I recall correctly.I converted to tabs also about 16 years ago and have never looked back. Tabs work properly almost everywhere. Same can't be said about spaces (reading, sure! but not writing), which are a pain in anything else but a really decent editor which understands the language syntax and some typical indentation rules and can thus align the cursor properly. With such editor though, they almost always support tabs, too, so good tooling solves the problem really, and you should be able to cope whichever is used within the project.I think the hatred for tabs is that many editors render tabs with width=8 (by default, or not configurable at all), and it seems excessive to some. This was one of the reasons I didn't like to use tabs when I was a newbie: lines went too far right. Of course, this was just an indication I was writing bad code. It was explained to me, I didn't believe it. Later I did see those more experienced people were exactly right: if my lines become too long, I need to refactor the code into functions/etc. 8-character wide indentation is really fine, and I use that now, all the time! And I was a true believer of 4 once, and used spaces to enforce that.Now I try to think about others, too. If I want to align things likeCode:uint8_t asd = something something |something something;, I do it byfirstusing tab on both lines,thenspaces, so that the alignment works out even if the tab width setting is changed! The idea is that code looks OK regardless of the setting. I don't go as far as actually checking it out with different settings, though.

author: snarkysparky
author_rank: Frequent Contributor
timestamp: February 19, 2022, 02:45:17 pm
content: object oriented programming ?

author: PlainName
author_rank: Super Contributor
timestamp: February 19, 2022, 02:46:15 pm
content: Perhaps programmers and EEs have the kind of mindset where they figure out a solution that works and that's The solution.It's more OCD than religion. With OCD you might not want to waste effort with the aggro of working out the proper solution again and again, whereas with religion it's just a belief that it is right regardless of the merits. I think with a technical person you could conceivably demonstrate a better solution, whereas with religion there is not a hope in hell of a conversion (otherwise they weren't really religious).

author: Bud
author_rank: Super Contributor
timestamp: February 19, 2022, 03:08:53 pm
content: For neatly looking text it is difficult to use spaces with proportional fonts. OK with fixed width fonts. TAB helps align lines of text correctly.

author: langwadt
author_rank: Super Contributor
timestamp: February 19, 2022, 04:12:05 pm
content: Quote from: Siwastaja on February 19, 2022, 01:54:32 pmthe problem is you can't easily just look at the text and tell the difference and sometimes tab vs. spaces matter.wonder how many hours have been wasted debugging makefiles because a what should have been a tab was spaces

author: Siwastaja
author_rank: Super Contributor
timestamp: February 19, 2022, 04:33:57 pm
content: Quote from: langwadt on February 19, 2022, 04:12:05 pmMakefile is a special exception, and make's designers have regretted that particularly stupid choice.I can't figure out any programming language in modern use which suffers the same design fault.But of course, if you use programming languages with significant whitespace, all bets are off anyway. You need to cope.

author: free_electron
author_rank: Super Contributor
timestamp: February 19, 2022, 05:31:29 pm
content: oldest profession in the world : electrician. when god said : "let there be light", those guys had been running cables for weeks...

author: PlainName
author_rank: Super Contributor
timestamp: February 19, 2022, 06:25:26 pm
content: QuoteI had exactly this (but the other way around) a couple of days ago, but can't recall what withDon't do Python so it wasn't that, and CMake is happy with either. Must've been so bad I burnt that memory out with a hot poker.

author: SiliconWizard
author_rank: Super Contributor
timestamp: February 19, 2022, 07:02:12 pm
content: Quote from: Picuino on February 19, 2022, 01:20:22 pmYes they are. And it's an efficiency issue. If you never took sides, you would keep changing your mind, never settle for anything and ultimately never achieve anything. We *have* to take sides just to be able to function.When it becomes pathological or "religious" is when you take sides on a particular topic that's not in your best interest or otherwise is objectively worse than another option. But in all other cases, that's a necessity. Heck, even when the particular choice you make on a particular topic is not the objectively best one - or is even the worst - it's often better to stick to one rather than constantly changing your mind and not being able to settle for anything.It's a misconception to think that "science" prevents that behavior. It absolutely does not, and for the reason I exposed above. Never taking sides would prevent you from achieving anything. Scientists take sides all the time. The bad ones will refuse to change sides when exposed to new evidence showing that their current "side" is bogus (and history is full of them). But meanwhile, they'll stick to a set of ideas. Just like anyone else.

author: m k
author_rank: Super Contributor
timestamp: February 19, 2022, 07:32:56 pm
content: Quote from: snarkysparky on February 19, 2022, 02:45:17 pmYes.My indent is 2 spaces.So in theory it can still be replaced.

author: free_electron
author_rank: Super Contributor
timestamp: February 19, 2022, 08:05:03 pm
content: i leave the indentation to the ide to figure out. like it should be. proper IDEs line up to word boundaries (first letter of the word on the line above to the right or equal to current position)

author: PlainName
author_rank: Super Contributor
timestamp: February 19, 2022, 10:41:59 pm
content: QuoteThat's kind of like leaving the driving to full autopilot - sure, it's nice to offload some tedium but you'll be stuffed when your motor goes in for repair and you realise you don't know how to drive the loaner.

author: Monkeh
author_rank: Super Contributor
timestamp: February 19, 2022, 10:51:56 pm
content: Quote from: dunkemhigh on February 19, 2022, 10:41:59 pmHe's paid too well to drive a loaner, he'd insist on getting a driver with it.

author: tooki
author_rank: Super Contributor
timestamp: February 19, 2022, 11:05:24 pm
content: Quote from: eugene on February 19, 2022, 01:23:15 pmYeah, I mean, only a handful of the world's biggest tech companies do their design and coding (at least partly) on Macs. But what would Apple, Google, FB, Twitter, IBM, etc. know about that...Turns out, code professionals also like computers that just work properly. And given that much of modern code runs on a remote server anyway -- and thus the computer is used largely as a web browser and glorified text editor -- it just seems silly to get your knickers in a twist about what computer someone chooses to use.Feel free to use whatever OS you like. But don't look down on others for their choice.

author: Circlotron
author_rank: Super Contributor
timestamp: February 19, 2022, 11:26:58 pm
content: This has to be the best example yet of a first world problem.

author: PlainName
author_rank: Super Contributor
timestamp: February 20, 2022, 12:49:58 am
content: That's has to be the best example yet of whataboutery.

author: Someone
author_rank: Super Contributor
timestamp: February 20, 2022, 01:12:04 am
content: Quote from: dunkemhigh on February 19, 2022, 10:41:59 pmand the reason most code bases end up with the worst solution: mixture of tabs and spaces. Its these idiots that assume everyone forevermore will use their exact IDE (version, platform, etc) and their choice of settings (probably default, but not always).All tabs, no worries,All spaces, no worries,But then mindless user with their "helpful" IDE that hides this and makes it look pretty for them starts adding in a random mixture of tabs and spaces.Different environments disagreeing on how many spaces to each tabanda mixture of tabs and spaces = painNow, trying to get people to agree on the first half of that equation is probably the actual issue, 2,3,4,8 spaces to represent a tab? (the video posed in the OP says 8 ). Until then you cannot use tabs to bring anything after some ragged text into alignment, only for the start of line before other characters.

author: Someone
author_rank: Super Contributor
timestamp: February 20, 2022, 01:17:09 am
content: Quote from: Picuino on February 19, 2022, 01:20:22 pmYou forgot the special example that only exists on this forum: "zooming out" on an oscilloscope!

author: Someone
author_rank: Super Contributor
timestamp: February 20, 2022, 02:09:15 am
content: Quote from: Bud on February 19, 2022, 03:08:53 pmPeople who want to use proportional fonts in programming:

author: eugene
author_rank: Frequent Contributor
timestamp: February 20, 2022, 02:13:56 am
content: Quote from: tooki on February 19, 2022, 11:05:24 pmFor the humor impaired, I was making a joke about religious technical opinions.

author: tooki
author_rank: Super Contributor
timestamp: February 20, 2022, 12:25:26 pm
content: Quote from: eugene on February 20, 2022, 02:13:56 amOr maybe my sense of humor is fine, but your joke was just devoid of humor and/or of any hint that itwasn'tmeant seriously...

author: eugene
author_rank: Frequent Contributor
timestamp: February 20, 2022, 03:06:27 pm
content: Quote from: tooki on February 20, 2022, 12:25:26 pmOK, I added an emoji for those that need to be told what is a joke and what isn't. Whether or not the joke is funny, I don't like the emoji; it's like a comedian laughing at their own jokes.

author: nctnico
author_rank: Super Contributor
timestamp: February 20, 2022, 05:45:41 pm
content: Has there ever been a thread title which is more self contradicting ?

author: newbrain
author_rank: Super Contributor
timestamp: February 23, 2022, 10:05:15 pm
content: Quote from: Siwastaja on February 19, 2022, 02:35:47 pmSpaces and tabs, meh...they are both overrated.You need neither to indent C code, or at all, as a matter of fact.Code:#include/**/<stdio.h>#include/**/<stdlib.h>#define/**/HELLOSTRING/**/"Hello\x20world!\n"int/**/main(void){/**/printf(HELLOSTRING);/**/return/**/EXIT_SUCCESS;}

author: nctnico
author_rank: Super Contributor
timestamp: February 23, 2022, 10:45:32 pm
content: @Karel: Wow!Just Wow... I thought I had seen all by now.

author: fourfathom
author_rank: Super Contributor
timestamp: February 23, 2022, 10:49:49 pm
content: Quote from: eugene on February 20, 2022, 03:06:27 pmWell, *I* thought it was funny. After all, it referenced the Apple / Microsoft / Linux religious wars.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 23, 2022, 11:14:58 pm
content: Also, I recall reading about some header file that made, maybe it was Forth or something, into valid (compile no warnings) C code. Woe be unto you, of course, if the syntax is ever so slightly off, and the resulting ill-formed macros explode everything to bits.Thus, the program becomes a polyglot, when such header is provided.(It's probably ioccc material, and I've probably remembered the target language wrong?)More seriously, and back to the original topic(?), I've been more mindful of late, how many things I repeat, or "know that I know" -- but don't actually have references handy to support those positions. Which might range from, say, experiments that I've done, but haven't documented for various reasons (long time ago, poorly recorded -- I wouldn't write an article about some effect illustrated with some crappy decade-old photos; just not very interesting to me, etc.), to articles I've ran across but not archived, to, just... a whole variety of things that I can't properly source (for the above and other reasons) that I have nonetheless synthesized into a more complete state of knowledge.The latter being the most frustrating of all, because, surely if I could just tell someone all of the truths that have come together to support some particular position I hold, surely they would hold it as well, but what are the chances they'll actually sit and read all of those things -- nevermind if I had those sources to hand -- let alone come to the same inferences?But, I rarely see others providing references either, so I'm not exactly feeling guilty about it, by way of peer pressure anyway.So that's, in part, my confessional non-confession, if you like.Tim

author: VK3DRB
author_rank: Super Contributor
timestamp: February 23, 2022, 11:27:27 pm
content: Similar issues in electronics hardware design. Those who use underscores as delimiters in net labels rather than hyphens in Altium need their backside kicked. Also those who overuse harnesses to the point they are unreadable don't know what they are doing. Harnesses are a kludge in Altium and should be used sparingly and with caution.It is nonsense to use small circles as pin 1 designators. They look like vias, solderballs, test points or fly vomit. All my footprints use small filled triangles (Place -> Solid Region) on the top overlay. Much easier to see and these have the added benefit of pointing to the chip of interest in a crowded PCB, reducing ambiguity.With software there are many annoyances, especially abbreviations that run into each other LKTHSDOES. Needless abbreviations, ambiguities and inconsistencies seem to be common. Not many hardware engineers know how to write decent embedded code. Some do. Most don't. Lavbiew is a classic where code can be written as if it was in the Wild West (unreadable mess) or beautifully composed using coding standards and a little extra effort.Any professional company should have coding standards for software development, and PCB Assembly design standards for hardware development. I learnt this over 20 years ago when a company I worked for used them. I have implemented standards in a number of companies since then.

author: PlainName
author_rank: Super Contributor
timestamp: February 24, 2022, 12:03:01 am
content: QuoteUh... <guilty look> What's the issue there?Edit: Altium do it.

author: free_electron
author_rank: Super Contributor
timestamp: February 24, 2022, 12:31:49 am
content: Quote from: Someone on February 20, 2022, 01:12:04 amProper IDE's can do this automatically. They strip all leading whitespace upon load and re-indent everything. just like they can colorize source.Visual Studio Code, Slickedit, Eclipse , notepad++ have been able to do that for decades.

author: Someone
author_rank: Super Contributor
timestamp: February 24, 2022, 01:02:28 am
content: Quote from: free_electron on February 24, 2022, 12:31:49 amThen what do they save.... hence the mess of indentation through large and/or historic code bases.Being able to make it pretty for your preferred settings /= correct.Whitepace changes to suit your preference = vandalism.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 24, 2022, 01:17:48 am
content: BTW, an actually useful argument in favor of tabs:https://www.reddit.com/r/javascript/comments/c8drjo/nobody_talks_about_the_real_reason_to_use_tabs/It seems the most effective use is to combine both, tabbing only to set indentation, then only spaces to align text e.g. when you have to lay out a table or something in the comments, or want to get nice columns of variables in repeating statements. The former of which is probably not a great idea anyway (e.g. Doxygen is just going to use a proportional font by default -- you have to use markup to layout that; better yet, just write the supplementary docs, alright?), and the latter, I mean, I like doing it (lining up statements), though I don't know how accessible it is. And all bets are off anyway with proportional fonts (as scary as it might seem to write code that way). Not clear how many use prop'l. for accessibility, but something to keep in mind in any case.Tim

author: SiliconWizard
author_rank: Super Contributor
timestamp: February 24, 2022, 02:30:23 am
content: Quote from: T3sl4co1l on February 24, 2022, 01:17:48 amThat's my take on this as well. TABs are effective at conveying indentation *and* make code much easier to navigate on top of that, both with keyboard and mouse (as clicking inside one indentation 'spacing' will just get you to the nearest token inside of just setting the cursor right inside it at some space character, which I find horribly annoying). But with keyboard navigation, spaces for indentation are just a royal pain. Similarly, I absolutely *hate* editors that do not stop the cursor at the end of a line but allow you to set it absolutely anywhere beyond the end of lines. It's freaking non-productive to a large degree.The only potential problem with TABs, when used to align text beyond the indentation level, is that alignment will of course get borked if you use a different TAB width (which in itself is not that big a deal - it's, or at least was, relatively common to document the TAB width used in source files in the files themselves for that exact purpose. But sure, it would still mildly annoy people who want to use a certain TAB width at all times, even when the source code is not theirs.)That said, I've found myself guilty of occasionally using TABs to align text beyond the indentation level, but I try to avoid that now.Better yet:I try to avoid aligning text beyond the indentation level altogether, which I think is usually a waste of time with little added value.I have better things to do than frantically hit the spacebar (or TAB key, when done "unproperly") just to supposedly make things a bit prettier (which is subjective.)

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 24, 2022, 05:14:03 am
content: Quote from: SiliconWizard on February 24, 2022, 02:30:23 amNot a fan of HOME/END, CTRL+arrows?CTRL+LEFT/RIGHT isn't all that efficient through a sea of operators or punctuation, but it's not too bad overall.I haven't used an unlimited-line-length editor since QBASIC......Oh no wait, that's not true. There's one. Altium's text editor, of course.(But anyway, I don't mind those too much, as long as END works, which, I haven't seen one that doesn't. Handy for, say, writing tables so you don't have to spam in all the white space, but not very useful beyond that.)The modern-ish feature that took me by surprise is ALT selection (columns). Now there's a handy editing mode!Tim

author: tooki
author_rank: Super Contributor
timestamp: February 24, 2022, 06:20:20 am
content: Quote from: SiliconWizard on February 24, 2022, 02:30:23 am”Tab” isn’t an initialism, so it’s not in all-caps.

author: pardo-bsso
author_rank: Frequent Contributor
timestamp: February 24, 2022, 04:35:30 pm
content: Quote from: SiliconWizard on February 24, 2022, 02:30:23 amMy editor has been inserting 4 (or whatever the current project requires) spaces every time I hit tab until reaching the correct level but I get your feeling of time wasting too

author: Siwastaja
author_rank: Super Contributor
timestamp: February 24, 2022, 06:12:59 pm
content: Quote from: T3sl4co1l on February 24, 2022, 01:17:48 amExactly this. Tabs are the right way because then everyone can choose their exact own preference, and code base written with tab indentation on the left will automagically just work for any setting. There is then no need to fight over the "right" amount of indentation.Choose spaces, and you will always be fighting. Maybe that's the point?And this is not religious technical opinion; it's the opposite. Using tabs (for the line indentation in code) has multitude of very strong, factual arguments behind. Anti-tabbing resembles more like a religion of some sort, though. The only real reason to use spaces instead would be some limited software which cannot output or handle tabs correctly, but such programs are extremely rare, I can't think of any example. The reality is more dire: there are two reasons to prefer spaces: "just because", i.e., people who just picked up this habit somewhere, never really thought about it, and just kept doing what seems to work well enough for them. I was in this group. And then; sociopaths, because picking the "space" side is a way of controlling others, and ensuring having some sparkling fights about the correct number of spaces and spaces vs. tabs.The former is of course more usual than being a sociopath. I was that way in the past, too. But sensible people who think about things (instead of making them religious choices of group identity) tend to convert into tabs at some point in their career. Unless they come into conclusion that it doesn't matterthatmuch; people use suboptimal processes like imperial units that get the job done for them, without being evil.

author: free_electron
author_rank: Super Contributor
timestamp: February 24, 2022, 06:35:02 pm
content: Quote from: Someone on February 24, 2022, 01:02:28 amWhy do i care what they save ? They could save it without any leading spaces. it would still be rendered properly in the IDE and compile just the same. The compilers don't care about leading spaces / tabs ( unless you code in that python crap )You can set your colorization to your liking ( i am colorblind : i do not see green. The receptor in my eyes is missing. so i may use different colors from anyone else ).IDE's are there to make your life easier. Use em instead of fighting useless religious wars over tabs / spaces, vi / emacs and kde / gnome , mac/ pc , windows / linux, flathead or phillips. Scraping along with pen and paper cause you don't like 'puters' is counterproductive.it doesn't matter that i use notepad++ , someone else slickedit and yet a third person uses visual studio. The code gets rendered properly. irrespective of tabs and spaces. That is what is important.

author: Someone
author_rank: Super Contributor
timestamp: February 24, 2022, 08:54:18 pm
content: Quote from: free_electron on February 24, 2022, 06:35:02 pmOnly rendered "correct" by your specific choice of editor/IDE. If the tools only clean leading whitespace then middle whitespace with tabs are still broken. Also a quick google suggests none of those programs auto indent on loading a file, its a user action (or automated on saving, eclipse might be able to do it on import but its not clear, requires plugin?). Decades you say? so it should be obviously documented and easy to point to a reference.But its the "why do I care" that is telling, exactly the attitude of: works fine for me and I don't value anyone else's time/effort. Hence the problem.

author: PlainName
author_rank: Super Contributor
timestamp: February 24, 2022, 09:08:50 pm
content: QuoteThat's what struck me, too.

author: eugene
author_rank: Frequent Contributor
timestamp: February 24, 2022, 10:53:12 pm
content: I might ask the question: are you saying that everyone, including me, should use [spaces | tabs], or are you saying that you personally prefer one or the other for your own use.I'm neither agreeing or disagreeing with free_electron, but he does have the advantage in that he's not trying to tell me I'm wrong in some way.

author: free_electron
author_rank: Super Contributor
timestamp: February 24, 2022, 11:26:38 pm
content: It doesn't matter to me what you are using ( spaces , tabs , tabs converted to 3 spaces, tabs converted to nine spaces ).Use whatever you want. i don't care because it is not a problem. (unless dealing with python , but that too is not a problem. i refuse to use that freakshow) .There is no 'standard' for indentation or tab to space conversion. Whenever you use some library it all seems to be done differently. Oracle Java specs a tab as 8 characters..If i will use your code i will load it in an IDE that cleans all that stuff (ya ya not automatic it takes a hotkey or menu action . so what ? ) and properly indents it according to MY rules. The way I want to see it.

author: alexanderbrevig
author_rank: Frequent Contributor
timestamp: February 24, 2022, 11:31:06 pm
content: I don't get why people still argue about tabs vs spaces!?Which leads me to some opinions:git is the best VCS, it can handle check in/out and keep tabs or spaces as is by file80 chars are not the only char width that makes sense (thank you, punch card storage boxes)vim is the only editor, vim is the best editor, if you disagree you've not really tried it (or using emacs which is fine) <vim makes me forget tabs vs spaces is a thing>private members does _not_ belong at the top of the file, give me what I probably come looking for firstcode style does not matter, good tooling does, autoformat on save all the things => smaller git diffs"not invented here" is just as bad in hardware design as it is in software, yes you can probably trust that footprint that's been used since 2005 by countless projects, even if you did not draw it yourself.if you cannot automatically test what you've made, you're doing it wronghating a programming language only means you're not an expert in itembedded developers use way too muchmagicin their code, the compiler is our friend, let's make use of it!In all honesty though, if you've got a colleague with bad vision: Show them vim!They will love the "not hunting for the cursor" aspect of the typical IDE experience, and of course the ability to set tab width that works for hard and soft tabs.So there, that's my head on the chopping block

author: Someone
author_rank: Super Contributor
timestamp: February 25, 2022, 12:22:35 am
content: Quote from: eugene on February 24, 2022, 10:53:12 pmThere is no general reason to prefer one or the other if you write code for yourself. You are not wrong for picking either, they are wrong for saying that it does not matter since their choice of text editor hides the differences (or worse, forcefully changes it to a specific indentation method+pattern).If you share work on code (particularly through a change tracking system such as git) and people need to edit each others files, then it becomes an issue. Editing text is a small part of delivering "code".Many text editors/IDEs will "work" with tabs or spaces (even with varying "sizes" for tabs), but you need to be careful not to make unnecessary changes when returning files with your new changes. Generally most people continue whatever indentation is already used in the file, or for a new file some agreed upon standard within the team/group. But feel free to be that one guy who no-one wants to work with if you insist on using your preference against whatever is already in place.

author: Someone
author_rank: Super Contributor
timestamp: February 25, 2022, 12:33:31 am
content: Quote from: alexanderbrevig on February 24, 2022, 11:31:06 pmCitation needed(consider the title/OP of the thread)https://vim.fandom.com/wiki/Indent_with_tabs,_align_with_spacesPromoting never mixing tabs and spaces, like the repeated suggestions in this thread:Quote from: Someone on February 20, 2022, 01:12:04 amQuote from: T3sl4co1l on February 24, 2022, 01:17:48 amQuote from: Siwastaja on February 24, 2022, 06:12:59 pm

author: alexanderbrevig
author_rank: Frequent Contributor
timestamp: February 25, 2022, 07:25:05 am
content: Quote from: Someone on February 25, 2022, 12:33:31 amI've had a hard time finding research on the subject, but every poll I looked at, vim is on tophttps://slashdot.org/poll/1717/favorite-text-editorhttps://opensource.com/life/15/7/your-preferred-text-editorhttps://www.linux.org/threads/poll-favorite-text-editor.6I know these only mean that the users of say slashdot, that are willing to cast a vote, prefer vim.Tabs vs spaces should not be a religious opinion as some file formats will dictate one or the other.YAML = spacesMakefile recipes = tabsThere's no way around it.If your editor can't help you with it, shame on it. If you don't change from archaic tools, shame on youNotepad++ et.al is like a crusty old soldering pen, where vim and emacs are the JBC and Metcal. Tools you can trust, and that grow with you.

author: Siwastaja
author_rank: Super Contributor
timestamp: February 25, 2022, 07:25:15 am
content: Quote from: alexanderbrevig on February 24, 2022, 11:31:06 pmBecause many people enjoy arguing, or even if they don't enjoy it, they are addicted to it.Using spaces to indent code is an excellent argument generator, because you can argue about the number of spaces and spaces vs. tabs until cows come home.Just using tabs, with the designated key on the keyboard, designed for exactly this purpose, would be too obvious, trivial, and Just Work. Therefore, it's not acceptable.

author: Siwastaja
author_rank: Super Contributor
timestamp: February 25, 2022, 07:28:14 am
content: ... practically you need to remember though that starting an edit war is the worst thing you can do. Even if you prefer the other way, when working in team projects, you have to cope with the choices made by others. The silver lining is, a file with either spaces or tabs is always somehow manageable.

author: alexanderbrevig
author_rank: Frequent Contributor
timestamp: February 25, 2022, 07:34:35 am
content: Quote from: Siwastaja on February 25, 2022, 07:28:14 amI agree, though choices should be explicit in anhttps://editorconfig.org/file (or something similar).

author: newbrain
author_rank: Super Contributor
timestamp: February 25, 2022, 09:24:36 am
content: Quote from: Siwastaja on February 25, 2022, 07:28:14 amThis.Working alone do whatever you like. Use edlin if you like.In any sufficiently mature organization there will be design rules, coding and style guidelines, and the code should not pass inspection if it does not abide by them.Spacing is only a very secondary part of those rules.They might not always be the best possible, and you have a right and in my case also a duty to try and improve them, but just complaining or being an anarchist is wasted effort or, worse, disruptive.The coding standard in the section where I work (8 spaces - you might catch the odd tab in some old codebase) does not match my preference (4 spaces - no tabs), but I see no reason to push for my personal preference - and I'm in the group that can decide on that kind of change.

author: samnmax
author_rank: Regular Contributor
timestamp: February 25, 2022, 12:08:01 pm
content: Personally, I prefer spaces. Mainly because I constantly use vertical alignment between different lines, for clarity.For example:Code:if ((vdsstat1.bit.VDS_H1 == 0u) &&(vdsstat1.bit.VDS_L1 == 1u) &&(vdsstat1.bit.VDS_H2 == 1u) &&(vdsstat1.bit.VDS_L2 == 0u)){If I had written it using tabs, with 4 spaces per tab, when someone with their editor set to 2 spaces per tab opened it, they would see this:Code:if ((vdsstat1.bit.VDS_H1 == 0u) &&(vdsstat1.bit.VDS_L1 == 1u) &&(vdsstat1.bit.VDS_H2 == 1u) &&(vdsstat1.bit.VDS_L2 == 0u)){With spaces, code stays how I wrote it.

author: VK3DRB
author_rank: Super Contributor
timestamp: February 25, 2022, 12:10:34 pm
content: Quote from: dunkemhigh on February 24, 2022, 12:03:01 amYou made it look better by selecting something else and fading everything. Depending on the view sometimes you cannot see the underscore at all. Especially on a printout. I never use underscores on net labels EXCEPT on differential pair net labels where Altium sadly gives the user no option.A better practice, IMO, is for example:I2C-CLOCKnRESET // Reset active when low3V3 // +3.3V, positve by default-5V // Must be a negative because it is not joining two words.Altium should fix this up so underscores can always be seen. A colleague said to me a few years ago, "Altium needs to completely re-architect and rewrite their software andnotmake it backwardly compatible. Start afresh, make the menus a bit smarter and more logical and fix the kludges up, like the harnesses. Also those sheet properties with the various title bar fields.. what a mess. I could add that Altium 365 is a bit of a mess too, but it works once everything is painfully set up between companies.If I was granted one wish for a feature, it would be for a "paint" feature like we get in MS Word, so that the attributes like fonts etc can easily be painted onto different text fields or whatever. As it is, it's a pin in the arse.

author: alexanderbrevig
author_rank: Frequent Contributor
timestamp: February 25, 2022, 12:55:04 pm
content: Quote from: VK3DRB on February 25, 2022, 12:10:34 pmThis makes it so you _must_ make a drag selection for selecting the whole label. Try double clicking I2C-CLOCK, then on I2C_CLOCK and be convinced to not use hyphens for identifiers.

author: PlainName
author_rank: Super Contributor
timestamp: February 25, 2022, 01:51:04 pm
content: Quote from: VK3DRB on February 25, 2022, 12:10:34 pmI did not. That's a straight screencap from the Altium help pages:https://www.altium.com/documentation/altium-designer/sch-obj-netlabelnet-label-adI thought that was obvious from the figure label "Net labels identify and..." 'Sok, no need to apologise.QuoteYes, after posting that clip I realised the problem. I use underscores for two reasons:1. (this involved natural language but, thinking about it, it's not really applicable)2. A hyphen is a no-no in code, and I like to use the same label in both schematic and code (to avoid confusion). Probably comes from my software background, although I did hardware before that - you certainly realise if you get it wrong in code, whereas a schematic label just starts an argument on a web forumQuoteThat would help, but it seems to me you can fix it yourself by choosing a suitable font. For instance, one where the underscore is at the same lower level as a normal character - the only reason underscores are that low is because you could overtype, but that's no possible on a computer (generally) so an underscore is always going to be on its own. If Altium provided that font it would encourage all users to use it, but it's possible to adapt your own without any input from Altium. Maybe someone has already done it.

author: Siwastaja
author_rank: Super Contributor
timestamp: February 25, 2022, 05:55:15 pm
content: Quote from: samnmax on February 25, 2022, 12:08:01 pmUse tabs to intend the "base" left side (where the if starts, usually one tab if this is in a function body, or two if inside a function and a loop), then continue with spaces to align for a fixed number of characters (to match the length of "if (" ). This way, the text aligns the same, but others can still use whatever tab width setting!

author: rstofer
author_rank: Super Contributor
timestamp: February 25, 2022, 07:43:42 pm
content: In the early years of my career, I was an electrician. Apparently the trade has a long history!I prefer that the Tab key put in as many spaces as required. No tabs in the file! It's not the '70s anymore, file size isn't that important when you have multiple multiple terabyte drives.I think I'm just going to let Visual Studio Code and Visual Studio decide how to do the indenting. There seems to be some thought behind the algorithm. Anyway, whoever wrote it is a whole lot smarter than me.How about a language where white space is ignored - totally ignored - like FORTRAN:DO10I=1 -- an assignment statement to variable DO10I?DO10I=1,3 -- right up until the compiler sees the comma and decides it is the start of a DO loop terminating at statement 10.

author: billbyrd1945
author_rank: Regular Contributor
timestamp: February 25, 2022, 08:12:14 pm
content: What really, really chaps me is the euphemism "slept together". Since I was born in 1945, I've seen all kinds of "loosenings" of mores for better or worse. Lucy and Ricky Ricardo slept in twin beds. Nowadays, even news broadcasters use "pissed" "pissed off", but you can't say you took a piss. And that's fine by me (the last part). But since we do use all kinds of words nowadays that were once forbidden in polite company, why in the hell can't we say "had sex together" instead of "slept together". You can even show two people under a sheet together being intimate. It's not a coincidence that all TV programming adheres to that convention. Someone decided that's the way it would be. You can't virtue signal with "slept together" and then show a couple humping under a sheet as they "sleep together". And that's another thing: Where do these people get off deciding such things. Oh, and one more thing, and this may be just me: Any time you see the back of a laptop on TV (probably movies too), it's always a Mac. Why is that? If it's not a Mac, it's some generic no-name badge. It's never HP, never Dell. And that would bother me even if I used a Mac, which I don't because I'm primitive and backward and slow and from the south. I feel better now.

author: Monkeh
author_rank: Super Contributor
timestamp: February 25, 2022, 08:22:18 pm
content: Well I've no idea where that whole rant came from or how it's topical, but..Quote from: billbyrd1945 on February 25, 2022, 08:12:14 pmBecause Apple have a gigantic marketing budget and, unlike HP and Dell, do not own the market, so they're the ones spending money to gain market share. It's called product placement.

author: PlainName
author_rank: Super Contributor
timestamp: February 25, 2022, 09:26:28 pm
content: QuoteIt has nothing whatever to do with file size. So far as I'm aware, it never has.

author: billbyrd1945
author_rank: Regular Contributor
timestamp: February 25, 2022, 10:08:28 pm
content: Quote from: Monkeh on February 25, 2022, 08:22:18 pmYep. I don't know why I didn't think of that. You're right.

author: RJSV
author_rank: Super Contributor
timestamp: February 26, 2022, 01:48:43 am
content: I did not see any reference here, but 'another' pain, happened when, God forbid, a WEB Site guy, (complete criminal hack, actually), got hold of my document (US Patent appl), and proceeded to 're-format' my huge document...by script commands...(sighhhh).Oh...and MADE MY COPIES READ-ONLY...Now, what was your prob, again ? (lol)

author: rstofer
author_rank: Super Contributor
timestamp: February 26, 2022, 02:39:34 am
content: Quote from: dunkemhigh on February 25, 2022, 09:26:28 pmI kind of think it was, back in the day where we only had SSSD 8" floppies (and maybe only one drive at that) of 256k bytes.https://www.cs.mcgill.ca/~rwest/wikispeedia/wpcd/wp/f/Floppy_disk.htmUCSD Pascal used to encode the space count at the beginning of a line into 2 byte sequences when working with text files.See --tabs page 30 here:http://ucsd-psystem-fs.sourceforge.net/ucsd-psystem-fs-1.22.pdfOf course, this was a long time ago.

author: Nominal Animal
author_rank: Super Contributor
timestamp: February 26, 2022, 05:56:11 am
content: Quote from: billbyrd1945 on February 25, 2022, 08:12:14 pmI'm primitive and backward and slow and from the far north. I hate cellphones. I hate instant messaging even more. E-mail and SMS are fine.I understand how certain words and concepts arerudeand maybedisgusting, like talking about the smells one encounters fixing sewers, at a formal dinner. What I do not understand is how certain words and concepts can bebanned. There is a time and place for everything, and banning seems to me to be a religious closing-of-eyes ruling. "Lalalalala I can't hear you, and therefore you don't exist."As to the subject at hand, it may be more useful to consideraxiomatictechnical opinions instead. The difference is that religious belief is an assertion; an axiom is an initial condition used to base useful knowledge on. For example, Kirchhoff's circuit laws aren't a religious opinion, they are just an axiom a DC or (long-wavelength AC) circuit designer can use to build an useful working circuit; or a person can use to analyze the operation of such an existing circuit.It becomes a religious belief only when you deny the existence and applicability of Maxwell's equations; or if you assert that Kirchhoff's circuit laws apply to high-frequency/short-wavelength AC circuits too.As to tabs/spaces, I don't have any trouble using whatever the project I'm working on. I do have a personalpreference, but it's about as strong as my preference for ice cream flavours, or pizza. (I don't get fazed by pineapple on pizza, either. My favourite tea flavours have bergamot oil [a citrus derivative, in Earl Grey tea], and I enjoy a bit of vanilla in my coffee [with milk, too], but I dislike cinnamon, after an unfortunate incident of gorging myself with cinnamon buns as a small child.)I believe the reason for this is that because I have done so much drive-by bug-fixing and patches, the fact that the diffs apply cleanly is much more important for me, in terms of time and effort.The way I like to align my variable names and in my own code prefer to add an extra space at certain places is a much bigger "issue"; many people don't like them. Because I'm backward and slow, I value the interaction with others more than my own inconsequential preferences, so when not "hacking" or providing "a crude example", I worry more aboutreadability and maintainabilityconsidering the possible developer set. This also explains why I often use Python for UIs and C for the actual number crunching: a majority of my potential users have machines with Python already installed, it is a scripting language (no development environment needed) with a gentle learning curve, so users who have ideas can easily try and enhance the UIs I've made, and if they succeed, they'll hopefully let me know too. Python itself isn't that good in my opinion, it's just the least unsuitable one.A completely different aspect is that humans love their tools.The religious aspect shows up only when they want to use their favourite tool to solve all problems, especially in domains they have zero experience in themselves."When the hammer is your only tool, all problems start looking like nails."The best antidote to this is experimenting with a wide variety of tools and wildly different problems.

author: Nominal Animal
author_rank: Super Contributor
timestamp: February 26, 2022, 06:28:02 am
content: Story time. It's related, I promise.At the end of the last century, I taught basic IT skills at an university: things like how to use email, email attachments, word processing in structured writing (essays, articles, thesis, as you normally have to do at an university), and so on. (Yes, I was a very young, barely adult whippersnapper back then.)I did not teach Microsoft Word. I taught how word processing programs work and approach the task of structured writing, with Microsoft Word as the example at hand.Things like why one needs to use styles instead of just picking the font and size (answer: because that way you mark the structure of your writing, and get things like indexes and lists of figures automatically), how to control section numbering and numbering formats, page numbering, and so on.I created the material online, and the only compulsory part was a basic test (that anyone with actual word processing skills could do in fifteen minutes or less) that was only graded as pass/fail, passing required before participating in courses that required those skills. (Another was image processing, with Adobe Photoshop as the example.)The students split into three completely distinct groups:Hey, I didn't know I could be this efficient with a word processing program! Neat, this saves me a LOT of time.I've used Word for years, and this test is a pain in the butt. An hour is not enough time to number the 45 pages (of supplied Lorem Ipsum -like filler text)! This is unfair! I'm going to complain to the head of the department so I can get a pass anyway.I'm NOT interested in knowing how these programs work. Can't you just show me which buttons to press so I can memorize them, and be done with this stupid computer stuff?I loved dealing with the first group. My approach was to always show how to do things the easy way, without compromising say visual layout. (Things like showing that if you have a specific layout you use very often –– like I do with article-like notes I write for myself for long-term use ––, you can do atemplatewith those pre-set.)Showing the third group that the work in the "exam" was exactly like the stuff they are supposed to work on later on in their studies, was usually enough. That the course/exam was necessary, for them to be able to do the work in reasonable time, and to be able to communicate effectively with each other (future colleagues) and the lecturers and professors. Some were just overwhelmed with the stuff they needed to learn, and had a culture shock with how different university was to high school.The second group was the hardest to deal with. (It was only later that I realized that power users who only have used a single operating system, have the most difficulties in transferring their skill-set to another operating system, for exactly the same reason. Simply put, it is easier to teach a typical computer illiterate to become a Linux/Unix sysadmin, than it is to teach a typical Windows-only power user or sysadmin for the same position, because the latter has toun-learnfirst.)They had already learned and adopted an approach to using programs, especially word processing programs. So, when that turned out to be completely bass-ackwards and inefficient, not only does it mean they had toun-learn, they also had to admit that they didn't know what they thought they knew. That's a blow to anyones ego; I know from personal experience. Repeated personal experience.Note, however, that none of this involved "religious" or "axiomatic" opinions. It was just an end result of using a tool (word processing) like another tool (typewriters, except with More Fonts) they knew before, without spending the time or effort to understand how that tool can be used in the easiest and most efficient manner.Compare to the space/tab discussion above: the points of when to use spaces and when to use tabs that describe an actual use case, are very useful. There is nothing religious or axiomatic in that, just discussing scenarios where using a tool in a specific way is useful. On the other hand, those who simply state what they prefer, only provide a single data point, a single factoid; and nothing others can evaluate or consider.Thus, we come to my perennial complaint: Instead of stating your opinion only,pleasedescribe the reasoning or experience you base your opinion on.If you cannot describe such basis, do consider whether your opinion has any worth, even to yourself; or perhaps it is something you ought to reconsider.It is only that reasoning or experience that is useful to others, because we're not religious automata that adopt new opinions just because they were presented to us.Well, I definitely hope we aren't, that is.

author: tooki
author_rank: Super Contributor
timestamp: February 26, 2022, 10:14:34 am
content: Quote from: billbyrd1945 on February 25, 2022, 08:12:14 pmThere’s plenty of product placement from other computer brands. You definitely see Dell and HP gear, too. Microsoft has done tons of product placement for the Surface line.You think it’s only Apple, but if you pay attention, it very clearly is not. Apple is clearly the #1, but given that product placement is insanely cheap marketing, it comes down more to who is willing to give it, and who’s asking, and what the producers think looks best in their show. Often, it’s literally just aesthetics and popularity. Apple devices have always been overrepresented in media due to aesthetics — even in the days when Apple’s market share was at its lowest and the company was popularly believed to be on death’s door. (Yet it’s also been said that at the time, Apple did not even sponsor product placement.)See e.g.https://productplacementblog.com/tag/laptops-and-notebooks/https://productplacementblog.com/tag/apple/https://productplacementblog.com/tag/dell/https://productplacementblog.com/tag/hewlett-packard/https://productplacementblog.com/tag/microsoft/I don’t know that site’s methodologies, so we cannot assume their statistics are representative. I provide them simply to disprove the claim that other computer brands ”never” do product placement. Moreover, your claim of “generic no-name badges” only saysyoudon’t know what the badges are. It doesn’t mean they’re no-name, nor generic.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 26, 2022, 10:57:20 am
content: Quote from: Nominal Animal on February 26, 2022, 06:28:02 amPerhaps we should emblazon this above the 'compose' textbox, rather than faffing around with 'thanks' mechanics?Appreciate the story, as always.Tim

author: PlainName
author_rank: Super Contributor
timestamp: February 26, 2022, 12:04:18 pm
content: QuoteInteresting. Of course, it could mean UCSD knew the proper solution to tabs vs spaces right back then

author: m k
author_rank: Super Contributor
timestamp: February 26, 2022, 12:10:03 pm
content: I use as little indent as possible so that 10th indent is still sort of around.For same reason I'm also adding rows instead of using wide single line stuff.I've also learned that there's a tool for source code text styling.

author: Nominal Animal
author_rank: Super Contributor
timestamp: February 26, 2022, 12:20:55 pm
content: Also, one needs to remember thatdiffhas option-b, andpatchhas option-l. (They create and apply patches ignoring differences in the number and type of whitespace characters.)

author: Siwastaja
author_rank: Super Contributor
timestamp: February 26, 2022, 12:37:38 pm
content: Quote from: m k on February 26, 2022, 12:10:03 pmSometimes (I mean, with some special languages or weird edge cases; I can't think of any example right now, so it's not a common requirement) you need those deep indentations, of course, but if you are doing this with the usual programming languages, then the 10th (actually already the 5th or so) indentation is a severe warning sign you need to restructure your code.I used to do indentation width of 4 and thought that 8 is absolutely ridiculous, the proof being that my lines wander up so far right. Experienced programmers were telling me to refactor the code, utilizing those fancy features likefunctionsto divide the bigger task into smaller subtasks. And indeed they were right, the problem solved itself, and now I'm just using tab width = 8 and do not see any problem with it.But I still remember my beginner days, and the problem with poorly structured code with deep nesting is that it tends to also suffer from long pieces of code with various levels of nesting. You can't afford large tab width because your lines end up too far right. Also you can't afford small tab width because then you easily lose track on what piece of code is on what indentation level. You just paint yourself into corner.But when writing proper, high quality code, suddenly you see that small details like tab width / number of spaces becomes far less relevant.Similarly, strong dependence on fancy editor features is a warning sign something is wrong with the code. With proper code, they can be helpful of course, but are again not that important.

author: m k
author_rank: Super Contributor
timestamp: February 26, 2022, 01:13:41 pm
content: You can easily comment those nested functions of functions away and have more meaningful descriptions than countless cryptic names.Functions are not the answer, structures are, and objects of course.With Microsoft you're also better of if you do wrappers.

author: billbyrd1945
author_rank: Regular Contributor
timestamp: February 26, 2022, 02:36:05 pm
content: You're right of course (that the Apple laptop thing is merely product placement). Being slightly paranoid, thinking that most of the world thinks I should be more Apple-like in my politics, it just seems more like a nudge to get right with the world: hug someone, get more green, embrace new pronouns, all that woke stuff. All in my head I'm sure. And what does this have to do with spaces and tabs? Probably nothing. Or it could be the same thing-- a tendency to glom on to certain mindsets.

author: eugene
author_rank: Frequent Contributor
timestamp: February 26, 2022, 06:54:39 pm
content: I'm not so sure that Apple is as socially progressive as they would have you think. Remember those TV ads that got Justin Long started? The ones where he would be the Apple guy, all cool and friendly while Microsoft was represented by a stodgy business man in a grey suit?Well, I've done contract work for both Apple and Microsoft. Apple would bully us into whatever they felt they wanted. IT was truly insulting sometimes, but they didn't care. We had to put in a completely separate shared network drive just for the stuff we did for them. This was literally different hardware from the network shares that we used for everything else. The only people that could access the drive were the ones thattheyauthorized. Visiting their campus at 1 Infinite Loop was much like visiting a military base. There were not groups of armed soldiers marching around, but there were plenty of visibly armed security personnel. Getting into any building required showing identification. Getting into any room required an employee with a swipe card to serve as chaperone. While there, the project manager pointed to each of us one by one and said, "I like you, I don't like you, I don't like you..." WTF? I would be fired for doing something like that, but it was evidently SOP there.Meanwhile, working with Microsoft was a very enjoyable experience. I recall one engineer saying, while on a conference call, "I hope you guys are having as much fun with this as we are." Visiting their campus was like visiting a vacation resort. There were small park-like spots scattered around outside with benches and decorative plants for a little bit of privacy. Inside there were gyms and workout rooms. They were obviously interested in their employees well being and even suggested that we could use the recreational facilities while in town.Please make note that I am not commenting on the stuff that either Apple or Microsoft sell, or the way they treat those of us that use that stuff. I'm just commenting on the way we were treated as contractors and the general environment they set up in their workplace.If you want my personal opinion, I am not fond of Microsoft and don't trust them, but I will never, ever support Apple in any way. Again, that is not based on their products but entirely on my view of the corporation itself.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 26, 2022, 11:51:41 pm
content: Quote from: Siwastaja on February 26, 2022, 12:37:38 pmI think the longest function I currently maintain (in my unimpressively sized personal codebase) is something like this:https://github.com/T3sl4co1l/Reverb/blob/master/console.cprobably not a big sin in the grand scheme of things -- and also I'm not really sure how else to do it -- but it has that inelegant smell. Maybe that's just how it has to be, overlapping a state machine with a character decoder. I guess the insight then would be to split off the state machine. The twoswitchs could maybe be split, but they also share variables so a few things would be duplicated or passed around. Not to mention thegoto...Oh, I should probably abstract away the serial calls, so it can do abstract IO calls instead. Though probably at some overhead (pointer function calls).Shrug, things to think about next time I have it open. Oh, come to think of it, this version hasn't been patched with the couple bug fixes I've found since then, either, heh.Anyway, a possible advantage to smaller functions, is better optimization. The compiler can only afford so much time to optimize sections of code, and large, interdependent stretches may perform quite poorly. That is, high complexity (in terms of number of clauses, cyclomatic complexity, AST depth, etc.) may limit the number of passes. (IANA compiler designer; this is probably at the right sort of thing, but not actually the most representative quantity.) These will be one-off functions not used anywhere else, so the compiler will happily inline them all for you -- presumably with whatever sequence of optimizations it finds beneficial. Hopefully including some before inlining? Anyway, even if you have to like pass around a dozen variables, or make a struct of your master-function local variables or something; once it's inlined, that's either trivial (register level), or you have enough that they go on the stack anyway so are only slightly less trivial to access remotely.My one example of "compiler throws up its hands" was a 24 to 16-bit conversion macro, i.e. for 5-6-5 LCD color. I initially wrote everything out in one uber-expression, using a few macros to expand a fairly simple expression into, something like 5 or 6 lines all written out. GCC didn't like that.At least not for AVR.Tim

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 27, 2022, 12:47:23 am
content: Quote from: eugene on February 26, 2022, 06:54:39 pmYa nah. They're "woke" in ads, it's performative. See also all the companies that change their logos to rainbows in Oct. But who also sell products in Russia, Arabia, various parts of Asia, etc. And who, suspiciously, for some reason, don't also change their logos in those locations...I mean look at their revenues, they're as hardcore a neoliberal company as you can get. They have to be, almost by law; they're publicly traded. Well, maybe that still counts as "liberal" to someone that's fallen off the deep (right) end in the US, but it's at best a very centrist position in the broader scheme of things. Where it really matters is this: how much of their money do they give to support progressive organizations? Lobbying for progressive causes? Giving to charities helping the poor, homeless, etc.? Supporting unionization within their organization, or elsewhere? (Not much of an issue for the most part, with the freedom of movement enjoyed by most in the tech industry, butvideo games have seen some organizationin recent years, and also, the inequality between C-suite and the worker has still only continued to rise, regardless of whether those workers are doing shop work or engineering.)The same happened to Google, what used to be a fair and open minded company ("Do no evil!"), quietly dropped its tagline a long time ago and joined the behemoths in being, about par for the course as far as megacorps go. That said... (continued below)QuoteYeah, that sucks... I see their interest for secrecy -- inevitably, the next iPhone 667 or whatever gets leaked before release; schematics and other design files drop out of supply chains; etc. It's critical to their marketing strategy, to protect that. So it makes sense to lock up contractors carefully that way, even if it means duplicating effort (what might be avoided by having stronger communication between employees and contractors, better visibility into internal projects, etc.). And I mean, they're not exactly hurting for profits, they can handle that.That PM sounds like something HR should've heard about though. Whether or not HR would take their side, who knows, or if they'd care what some menial contractor has to say. Think I'd want to at least scribble that interaction in my notepad, maybe ask the PM later about it (say to confirm they said what had been written down -- will they double down for it?), though that's probably too direct/confrontational; maybe take it to another higher-up or to HR. Something else to put on their file if nothing else.Assuming there wasn't other context of course. A simple "like/not like" isn't exactly grounds for dismissal, and could make sense in context, if maybe not being a very professional thing to say, even in context. I'm assuming from your impression, this wasn't the case.Quote(continuing from above)... That's good. Probably, they've been around this for long enough, that they know better than to dig in too deep. Can't exactly crunch-time something as important as a whole-ass operating system, and it doesn't make sense anyway for things like continuous development or the like (e.g. might also consider Windows Updates as a coarser kind of CD).And there's Facebook, which as far as I know is more or less generally okay with management of workers, but you also have their involvement in the manipulation of now several countries' political processes, on top of the glaring privacy issues, unfair ad marketing, etc.). They pay quite highly these days, so I've heard, and with good reason, still having high turnover despite that pay. (I mean, no idea what the overall numbers are, but many treat it as a shiny badge to stick on the resume, so, just work there for a year or two, do a few projects, learn how to do things at truly world scale... then get away from that mess.)Or Amazon, as far as I know very much on the grind from top to bottom. Software side maybe not as bad as warehouse but still under constant/implied threat of PIP. (Performance Improvement Plan: give worker unrealistic expectations as grounds for termination.)QuoteAs a rule, it's a good idea not to trust any large company. They make too much money in too many ways and places, to have any kind of ethics, or transparency. Trust is earned, not given. Similarly, it may not be possible to avoid exploitation in a capitalist society, but we can at least try to reduce our individual impacts on that. Using Amazon, Alphabet, MS or other services, at all, is not a moral failing but an unfortunate inevitability given their scope. The best we can do then, is to reduce our use of them.I mean, if you want to get all ethical about it. Or political. At least it's not religion, amirite?...Tim

author: Bassman59
author_rank: Super Contributor
timestamp: February 27, 2022, 12:48:33 am
content: Quote from: Nominal Animal on February 26, 2022, 05:56:11 amSee, I'm from New Jersey, and if you even mention "pineapple on pizza" in New Jersey, you'll be met with an armed response, and not just from the made guys sitting in the back of the pizza shop with their little notebooks counting out cash.As for tabs vs space, I honestly don't care. The editor sorts that out.

author: newbrain
author_rank: Super Contributor
timestamp: February 27, 2022, 01:43:06 am
content: Quote from: Siwastaja on February 26, 2022, 12:37:38 pmI still find 4 as the goldilocks indentation step: any less and my eyes lose track of the nesting, any more (i.e. 8 - I never met anything like 6 or odd numbers!) and the jumps are too wide and disrupt the flow of my reading. Not being 4 the standard tab size, I prefer spaces.For the same reason of ease of reading, i use Allman style: the vertically matched braces helpmycomprehension.Using 4, though, is not an excuse to for crazy nesting depths: I think the deepest in my code is 5 (in a bitmap font drawing function for LCDs) - refactoring the inner part as a function would need to pass too much state for very little gain in readability.But indenting and formatting are mechanical operations, and, guess what, computers are good at those.So I leave them to clang-format, usually through VS (Code or full), with the following style:Code:{BasedOnStyle: LLVM,UseTab: Never,IndentWidth: 4,TabWidth: 4,BreakBeforeBraces: Allman,IndentCaseLabels: false,ColumnLimit: 0,AccessModifierOffset: -4,AlignConsecutiveAssignments: true,AlignConsecutiveDeclarations: true,AlignConsecutiveMacros: true,AlignEscapedNewlines: true,AlignTrailingComments: true,AllowShortIfStatementsOnASingleLine: true,PointerAlignment: Right}That said, at work I witnessed a piece of open source code with McCabe complexity of138: no formatting or indentation could save it.Luckily, I was not the person that had to modify it.

author: Nominal Animal
author_rank: Super Contributor
timestamp: February 27, 2022, 02:03:41 am
content: Quote from: Bassman59 on February 27, 2022, 12:48:33 amYup. One is protective of the things they love and cherish, and there is not much that is as close to ones roots and culture and heart as food is.Consider Finnishmämmi. It looks disgusting. The malted rye taste is weird, and when mixed with cream, even weirder. I like it. However, it is not the taste, but the cultural roots behind it, that makes it 'important' to Finns. It is something utterly typical to Finns: in the olden times, in spring – Easter –, we had no fresh fruit or berries or anything like that left for sweet desserts, so discovering the rather interesting chemical process that produces such complex and sweet flavours at just 2% sugar content is a testament to the tenacity and inventiveness of Finns. The first part of the process, 'imellyttäminen', does not have a proper translation to English at all, and is usually translated as "natural sweetening process" or "caramelization", and occurs when enzymes convert starch to maltose (which provides the sweetness). The second part is the Maillard reaction during baking, providing the complex flavours.If you know the history, then it is a completely different thing to try and taste mämmi: it's about how humans without many resources in rather harsh natural conditions found ways to celebrate; and nowadays is a way to connect to ones cultural roots generations back. And the way it is made, it's safe to eat, too. (You can get an upset stomach if you eat too much. Complete maltose intolerance is exceedingly rare.) Not telling someone any of this, and making them taste mämmi, is cruel and ignorant, in my opinion.

author: nctnico
author_rank: Super Contributor
timestamp: February 27, 2022, 02:16:43 am
content: Quote from: Bassman59 on February 27, 2022, 12:48:33 amAnd how & why would people from New Jersey get upset about an Italian dish? Due to lack of a local cultural heritage they may feel connected to Italy because their ancesters came from there a couple of centuries ago but most likely they don't even know where Italy is.Meanwhile in Italy:https://florianscafe.it/menu/Random pizzeria in Rome, Italy where they have pizza Hawaii on the menu.

author: SiliconWizard
author_rank: Super Contributor
timestamp: February 27, 2022, 02:23:35 am
content: Quote from: newbrain on February 27, 2022, 01:43:06 amI don't like having to deal with spaces for indent, as I said earlier. But I agree with the width of 4 being the sweet spot.2 is really too little to be useful as indentation IMO and, last time I used that was in the 90s when screen estate was still at a premium.8 is ridiculously large IMHO. It's then funny to see that this is the default width used for displaying code in github, and many other similar web sites.It's either as though they just have no taste (to quote Steve Jobs), or they just do that on purpose to kind of push people to use spaces instead of tabs. You know, as a way to show the world that people using tabs are doing it wrong. Either way, there's something twisted there.Quote from: newbrain on February 27, 2022, 01:43:06 amSame. I've always disliked the TBS thingy. Which is "true" for whoever coined the term anyway. Sure there is personal preference in that, and then habit and "education".Some people have been exposed to TBS from the get-go and just don't know any better, and are used to that. I wasn't actually, because back when I learned C, despite being the style seen in the K&R book, it was actually rather rarely used at my uni - and in a lot of open source stuff that existed back then that I was exposed to. But of course your own experience may vary.But these days, it seems like another kind of "war" for many, which is just so dumb.

author: Nominal Animal
author_rank: Super Contributor
timestamp: February 27, 2022, 03:28:59 am
content: Quote from: nctnico on February 27, 2022, 02:16:43 amThat's justthickcoming from someone in the Netherlands. Haven't conquered enough indigenous peoples around the world, eh? Then go smoke something, won't you.The snide remark aside, it is a well known phenomenon thatspecificcultural heritage details are strengthened in emigrants, exactly because of their emotional ties. Food is a typical one; a specific dish or type of food is often more popular among specific emigrant population than in the originating country, because it is the cultural-emotional tie. Sometimes it is religious or traditional garb used in specific ceremonies. Or, say, a lady TV presenter having traditional face tattoo. As time progresses and the emigrants integrate into and become part of a local culture, a specific dish originating half a world away can easily become the 'food landmark' of a region. So, people in New Jersey today having a specific dish they associate with like that,is perfectly normal.It's like Finns always building a sauna wherever they live. Even Finnish peacekeepers always build saunas. Even in the middle of deserts. As locals visit and try it out, they sometimes take a liking, and you end up with small regions that have lots of saunas, with no Finns (or Nordics) at all. You'd think it's weird, but it's not: that's how influences naturally spread. I think it is a good, interesting thing.Culture is not just "we were a huge power once, with amazing music and architecture and arts"; it is what ties people together at any point in time. Their values and customs. Food is a very typical thing where the unique features of each culture tend to pop up. Their actual historical origins can be quite funky and weird and distant: that too is typical to us humans.

author: Nominal Animal
author_rank: Super Contributor
timestamp: February 27, 2022, 04:05:32 am
content: The Wikipediaindentation stylearticle has a point aboutstatement insertion, that makes me keep the opening brace of conditional and loop blocks at the end of the line containing the controlling statement, as opposed to on a new line aligned with the corresponding close brace as in the Allman style.Which means that for my own code, I guess I prefer the 4-character tab version of the Linux kernel indentation style with unlimited line lengths?(In truth, it is just what seems most readable to me.)When I work with existing codebases, I use whatever they use. It is much more important that the style is consistent, than what that style actually is. (I don't like the GNU style because of the "half-indents" and function return type being on its own line; I read such code slower than code written in other styles, even though I'm very familiar with the style. I do not dislike the style enough for it to affect my opinion on any code using that style, though.)After all, coding style – including spaces vs. tabs – is only a 'thing' because consistency makes reading and maintaining code easier. They all work, the preference just varies from person to person.Indeed, coding style 'wars' are ridiculous arguments, because we do have automatic tools likeindentto change the style if necessary. Usually it is not necessary, and is just a 'war' over flavour...bike-shedding.Would anyone really refuse to work on a code base because of its indentation style?

author: Siwastaja
author_rank: Super Contributor
timestamp: February 27, 2022, 07:48:18 am
content: Quote from: SiliconWizard on February 27, 2022, 02:23:35 amIt's funny how a human being adapts to anything. Like if you halve the amount of salt you put in food, it tastes ridiculously... tasteless. It justcan'tbe right. Yet, in a few months, it starts tasting completely normal. I have also dropped the amount of sugar I put in coffee from ridiculous 4 teaspoons(!) per cup* to maybe a half teaspoon.*) coffee cup = 250mlI used to think that 8 is ridiculously large indentation, too, and messes up with the "flow" like newbrain said. Yet, for some reason I don't remember, I just started using tab andnotconfigure my editor beyond defaults. I don't remember how long it took, but probably not more than half a year, until 8 started to look completely normal, and 4 (what I had been using for 15 years or so) a bit weird, instead.At that point, I realized the "sweet spot" is actually a surprisingly wide range. Inside that range, it's only a personal preference which is not much more than what you areused to. From purely physiological/psychovisual viewpoint, I think anything between 2-10 does the job.

author: PlainName
author_rank: Super Contributor
timestamp: February 27, 2022, 08:30:23 am
content: QuoteHad to look that upEr, that's what I do. Originally I used the Allman style but it wastes two lines unless you have a single indented line and no braces. I didn't like K&R/TBS because the braces don't line up, but then I I figured the closing brace was the important bit and easily matched to the opening statement, and most important it could be consistent: one line or many lines you always use one extra for that last brace.The consistency is important to me. With Allman style there is a huge temptation to skip the braces if you only have one code line, but that can lead to conditional lines being executed when they shouldn't be if the code is modified. For that reason I consider always using braces, and the only scheme that doesn't waste lots of lines in TBS.Not completely sure whether indenting the brace (Ratliff) is good or not. Not indenting (K&R) lines it up with the start of the statement, but it's then adrift from the indented code. If the brace is indented there's a solid straight line of everything so easy to follow. Same issue with Allman/GNU style and currently I am favouring not indenting (that is, the brace lines up with the start of the statement).Having said that, I am currently porting some code I wrote in '96 which used indented Allman and it's pleasingly readable. Hmmm.[Edit: checking the wikipedia entry it seems I got the styles mixed. Updated]

author: Nominal Animal
author_rank: Super Contributor
timestamp: February 27, 2022, 08:45:54 am
content: Quote from: Siwastaja on February 27, 2022, 07:48:18 amNone for me, but with milk, please. With tea, I like some liquid honey. (The crystallized stuff is often sugary; that is, is not actually honey, but a mix of sugar and honey. Crystallized honey is okay, though. Never plain sugar; don't like the taste.)Quote from: Siwastaja on February 27, 2022, 07:48:18 amI agree.

author: tooki
author_rank: Super Contributor
timestamp: February 27, 2022, 08:56:04 am
content: Quote from: Bassman59 on February 27, 2022, 12:48:33 amOK, that actually gives me one positive thing to say about New Jersey!(I joke about New Jersey, but mostly because my friends from New Jersey have encouraged it!)

author: tooki
author_rank: Super Contributor
timestamp: February 27, 2022, 09:15:27 am
content: Quote from: T3sl4co1l on February 27, 2022, 12:47:23 amFWIW, I worked at the fruit stand (Apple retail) many years ago, and while it had its issues (like any workplace), they honestly treated their retail workers way, way better than average. I certainly don’t believe it’s “all performative” — my experience with the company is that, for the most part, they really did believe in the things they said they do.And yes, the secrecy within Apple runs through and through. I worked the launch of the original iPhone, which was the biggest product launch in the company’s history. The Sunday night before launch, we had an all-hands meeting (in our case, amusingly held outside the store by moonlight on the fiberglass dinosaurs in the mall playground because there was a power outage!). The inventory for launch day arrived in advance, kept in lockers, without anyone in the store except the inventory specialist knowing about it. On launch day, we had to close the store at 4pm, then had two hours to redecorate the entire store (something normally done over 4-6h as an overnight shift) and get our only hands-on experience before opening at 6pm to let the crowds in.Biggest launch in company history and we got to see it a whopping two hours before selling it.I also worked the launch of the MacBook Air at the Macworld expo in 2008. Even as someone who’d be working the Apple booth, literally demoing the thing to both media and the public, we didn’t get any advance notice of the products being launched, we watched the keynote just like everyone else, then went across the street to the booth and got to work.As an Apple employee, I was able to get my own badge to enter the Apple headquarters unescorted, but obviously everything interesting requires special access permissions.

author: Someone
author_rank: Super Contributor
timestamp: February 27, 2022, 11:20:19 am
content: Quote from: alexanderbrevig on February 25, 2022, 07:25:05 amBut you said it made you forget tabs vs spaces. Another poster thought their choice of editor magically fixed it, how does vim make the problem easier?

author: m k
author_rank: Super Contributor
timestamp: February 27, 2022, 12:10:45 pm
content: My text has many indents, couple nested cases and it's over 10.Then if innermost has a Widows API call its parameters are far far away right.I'm also from Pascal land and can't stand end of line begins.But what kind of a professional offers totally unneeded functions eating time of possibly millions of unneeded calls.One must also wonder what makes a know-it-all, self-righteousness, religiousness or something else.

author: nctnico
author_rank: Super Contributor
timestamp: February 27, 2022, 12:37:37 pm
content: Quote from: Nominal Animal on February 27, 2022, 03:28:59 amWe should have conquered the Finns as well and fix their sarcasm detection skills.

author: Siwastaja
author_rank: Super Contributor
timestamp: February 27, 2022, 01:04:48 pm
content: Quote from: m k on February 27, 2022, 12:10:45 pmFunction call overhead is really small. Furthermore, with compiler optimization, automatic or guided (even forced) inlining, you can decouple optimization from writing good code. Only very rarely needs code quality suffer because of performance, and then it's about something else than dividing work into functions (which can be inlined after all).It sounds like you just "can't" write good code, youknowthis yourself, and are making up excuses (to yourself, no one else!) to keep doing what you do.And don't get me wrong, I'm not claiming to be a great coder myself, either, and I still sometimes write really crappy code in stressful situations, which I can see myself. But improvement starts from admitting you have a problem (to yourself; no need to admit it to anyone else if and when it's hard to one's ego).But Ithink(I'm not sure of course, there are many contributing factors, too) that using wide tab width has kinda forced me to break down the code to smaller modular pieces, or think about how something is implemented, because indentations longer than 4-5 tabs then start to really stand out, in a bad way. 3D loop inside a function still looks OK, but if I then add a switch-case inside it, eye pain makes me think: maybe this switch-case should become parse_token(...)? And then, the magic happens: I realize I need to parse_token() somewhere else, too, and don't need to copy-paste the code. Even better, maybe parse_token() can go through some configuration struct instead of being a massive switch-case.Thepointis, if minor workflow details like indentation width or IDE autocompletion features seem to become massive pain points (instead of just tiny convenience factors), that's definitely an alarm sign, IMHO.But "I need to write crappy code because of performance" actually is quite religious. I know very well because I have resorted to that argument, myself. I have been shown to be wrong by more experienced people, and have learned as a result.

author: Nominal Animal
author_rank: Super Contributor
timestamp: February 27, 2022, 01:36:52 pm
content: Quote from: nctnico on February 27, 2022, 12:37:37 pmNever! We'll fight to the last polar bear before we'll learn small talk and social skills.

author: langwadt
author_rank: Super Contributor
timestamp: February 27, 2022, 01:59:44 pm
content: Quote from: Nominal Animal on February 27, 2022, 03:28:59 amback in the 80's everyone here was building a sauna as part of their bathroom, most of them was used once or twice and then used to store toiletpaper and lawn furniture in the winter ...

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 27, 2022, 02:10:48 pm
content: Quote from: Nominal Animal on February 27, 2022, 01:36:52 pmTim

author: nctnico
author_rank: Super Contributor
timestamp: February 27, 2022, 03:01:32 pm
content: The picture above (on the previous page) does not do justice to my experience with people from Finland thoughI used to have a favorite restaurant in Helsinki.

author: hans
author_rank: Super Contributor
timestamp: February 27, 2022, 06:03:48 pm
content: Can't resist. People who program Python may find this familiar.

author: Bassman59
author_rank: Super Contributor
timestamp: February 28, 2022, 03:31:01 am
content: Quote from: nctnico on February 27, 2022, 02:16:43 am... because what we in New Jersey called "pizza" is not really what residents of Italy would call pizza. Though it's been made by Italian immigrants for generations and these folks are protective of it. \I can point to the time when I realized that the mob's influence in Hoboken, NJ, was waning -- when a Domino's pizza franchise opened on that city's main drag, Washington St. No way the mobsters of Sinatra's generation would have allowed that. Allow, the "product" sold by Domino's is not pizza. There are ongoing discussions about whether it's even food.QuoteIt's funny you mention this, because ... you're right. There was a story arc on "The Sopranos" in which Tony and his crew go to Sicily for a meeting with the mob there, and they're typically and hilariously way out of their league and out of touch. But it does point out how Italian culture in the USA has diverged from Italy.Don't get me started on the Italian-Americans' completely misguided adoration of Christopher Columbus.QuoteTruly the mob is dead!

author: Nominal Animal
author_rank: Super Contributor
timestamp: February 28, 2022, 06:46:53 am
content: Quote from: nctnico on February 27, 2022, 03:01:32 pmThat is the very nature of stereotypes, isn't it?(I have dutch in-laws, and that was absolutely the most annoying pair of stereotypes I could come up with. As to Finns, it is absolutely true that if a Finn stares at you, they are just wondering whatyouthink aboutthem; and that many, many Finns avoid speaking foreign languages they know, because they think you might find their accent ridiculous or difficult to understand. I can tell an exchange student in ten minutes how to get Finns to approach them and interact with happily, anywhere in Finland: it's somewhat similar to how you do it with horses, really.)

author: dietert1
author_rank: Super Contributor
timestamp: February 28, 2022, 11:13:54 am
content: Amazing discussion. Still on page 4 one can read opinions about spaces and tabs..Regards, Dieter

author: newbrain
author_rank: Super Contributor
timestamp: February 28, 2022, 12:24:24 pm
content: Quote from: dietert1 on February 28, 2022, 11:13:54 amAnd pizza.It's about religions, after all.And gif is pronounced as the 'ghi' in 'Studio Ghibli'.Quote from: nctnico on February 27, 2022, 02:16:43 amProbably trying to cater to a mostly non-local patronage, given where it is located and how it presents itself.Also a lunch place for office workers in the area.Eh, when in Rome do as the Romans do.Being (also) one I goherefor Napoli style pizza - just a nice pizzeria in my neighbourhood, nothing fancy, but some 'experimental' pizza now and then - still no pineapple in sight. Not cheap though.For Roman style pizza, I have other places.