From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c9d5fc258548b22a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!news.mixmin.net!news2.arglkargh.de!noris.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: How do I write directly to a memory address? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <67063a5b-f588-45ea-bf22-ca4ba0196ee6@l11g2000yqb.googlegroups.com> <05a3673e-fb97-449c-94ed-1139eb085c32@x1g2000yqb.googlegroups.com> <8r86vgFc3uU1@mid.individual.net> <19fh1chm74f9.11cws0j5bckze.dlg@40tude.net> <4d4ff70e$0$6886$9b4e6d93@newsspool2.arcor-online.net> <737a6396-72bd-4a1e-8895-7d50f287960e@d28g2000yqc.googlegroups.com> <4d5008a5$0$6879$9b4e6d93@newsspool2.arcor-online.net> <4d5031fe$0$6765$9b4e6d93@newsspool3.arcor-online.net> <1f229967-d3cf-42b6-8087-c97ee08652f3@i40g2000yqh.googlegroups.com> <4d51169e$0$7657$9b4e6d93@newsspool1.arcor-online.net> <1bnp0pw1c8r5b$.guxc48qweiwe.dlg@40tude.net> <4d51a1c0$0$19486$882e7ee2@usenet-news.net> Date: Tue, 8 Feb 2011 21:27:34 +0100 Message-ID: <11zwq15839vrp$.1bra4zhtvk6u0.dlg@40tude.net> NNTP-Posting-Date: 08 Feb 2011 21:27:31 CET NNTP-Posting-Host: 795f257e.newsspool3.arcor-online.net X-Trace: DXC=DRmh90=F@Nh^Y=RbYBPl4`McF=Q^Z^V3h4Fo<]lROoRa8kF On Tue, 08 Feb 2011 15:01:39 -0500, Hyman Rosen wrote: > On 2/8/2011 2:43 PM, Dmitry A. Kazakov wrote: >> Three candidates in a row I have interviewed for a C/C++/C# position could >> not answer the question how to test the 3rd bit of a byte in C. All three >> had 3+ years of programming "experience." > > (byte & (1 << (3 - 1))) > > Just saying. Huh, I have no doubt that *you* would pass. But to those guys the very concept of masking was unknown. That is not all. The result of masking (as in your example) is not a bit. It might sound unbelievable, but for one of them even the jump from (byte & (1 << (3 - 1))) to if (byte & (1 << (3 - 1))) { ... } was too much. He could not gasp the obvious[?] that testing for non-zero is equivalent to testing the bit. When confronted a formula similar to yours, he objected that it is not a bit! >> Their bird-brains are pre-filled filled with rubbish >> unrelated to programming. E.g. how to use VisualStudio, MS-Word, Outlook >> and hundreds of other useless overblown tools etc. There is less and less >> place to memorize the ticks and pitfalls of C. > > That's not a valid criticism. Much programming today is done > for platforms where even the simplest program requires a fairly > elaborate framework, because the old "one keyboard, one ASCII > terminal, one input, one output" paradigm does not exist there. > The tools are used to generate that framework and to assist in > programming within it. As you say, there is less and less time > to waste on programmers who insist on coding these frameworks > by hand from scratch. This or that way, it seems that no room left for the concept bit masking. >> I am not sure if Ada could really save the world, but it is certain that C >> significantly aggravates the situation. > > How is it the fault of C that we now program on these platforms? > How do you test the third bit of a byte in Ada? In Ada you could shape it as Byte (3) But this is not my point. My point is that there is less and less room for trickery C programming requires. C is much too complex for an average programmer and the gap grows day by day. > *Why* do you test > the third bit of a byte in any language? Are you sure that the > questions you are asking reflect the needs of your organization > rather than representing the "get off my lawn" screams of a paradigm > becoming obsolete? The positions were for automation, control and embedded applications. The guys would read sensors, write actuators, program ECU etc. They weren't hired for designing web-sites and in their resumes they wrote "embedded programming experience." BTW, they didn't lie! Watch up, it is well possible that some devices around you were programmed by such guys! -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de