1,510 karma · joined February 23, 2010
Let's challenge this specific claim, that when you do "if (foo == bar)" -- I corrected the syntax error, which is a symptom of C's high-level syntax and not of the underlying assembly code -- you compare one value to another and then jump. For this challenge,I will write some trivial code that we should be able to make easy assumptions about, and I will compile it with debugging enabled so that I can dump the results with gdb.
$ gcc -g example.c
1 #include <stdio.h>
2
3 int main() {
4 int foo = 10;
5 int bar = 20;
6 if (foo == bar) {
7 printf("Fun\n");
8 }
9 return 0;
10 }
Dump of assembler code for function main:
0x0000000100000ef8 <main+0>: push rbp
0x0000000100000ef9 <main+1>: mov rbp,rsp
0x0000000100000efc <main+4>: sub rsp,0x10
0x0000000100000f00 <main+8>: mov DWORD PTR [rbp-0x4],0xa
0x0000000100000f07 <main+15>: mov DWORD PTR [rbp-0x8],0x14
0x0000000100000f0e <main+22>: mov eax,DWORD PTR [rbp-0x4]
0x0000000100000f11 <main+25>: cmp eax,DWORD PTR [rbp-0x8]
0x0000000100000f14 <main+28>: jne 0x100000f22 <main+42>
0x0000000100000f16 <main+30>: lea rdi,[rip+0x19] # 0x100000f36
0x0000000100000f1d <main+37>: call 0x100000f30 <dyld_stub_puts>
0x0000000100000f22 <main+42>: mov eax,0x0
0x0000000100000f27 <main+47>: leave
0x0000000100000f28 <main+48>: ret
We see that in the very basic version of this code with absolutely no optimizations and doing the silliest things that we can, we store our two values into some memory locations, perform a comparison (cmp), and jump if not equal. We can see that the jump leads us to the puts() call.Now, let's get smarter. The variables foo and bar do not change value, and we only work with two variables in the routine. Therefore, we could optimize by storing those values in temporary registers instead of using expensive memory transfers. Further,since our two constants are being compared and will always return a false, we actually have a section of code -- the printf -- that is dead code, that can be completely removed from final compilation. Well, that's simple, and everyone who uses C in production at least turns on some minor optimization:
$ gcc -g -O1 example.c # the only difference is the -O1
Dump of assembler code for function main:
0x0000000100000f34 <main+0>: push rbp
0x0000000100000f35 <main+1>: mov rbp,rsp
0x0000000100000f38 <main+4>: mov eax,0x0
0x0000000100000f3d <main+9>: leave
0x0000000100000f3e <main+10>: ret
This does not look like our C code at all! And thankfully so! What a waste of space and CPU time it would have been had we treated C like an interpreted language! C is a high-level language with numerous compiler implementations that can intelligently convert the human-readable code into the binary code that represents the real situation behind the code.The point here is that you are not properly guessing the assembler code that will be produced. The compiler is doing a better job of that; that is the compiler's job. As a programmer, you can just focus on the algorithm. C is not an assembler macro language. For that, you would use things like "gas".
I grant that people may believe this, but I disagree that it is true. If you ask me now my social security number, and I silently refuse to answer, or I ignore you, am I a liar? Of course not. I am not submitting a "white lie"; I am saying nothing.
If my silence is crafted to deceive you, that is another story entirely. There is a difference between "silence intended to deceive" and "silence intended to not answer". Usually there are other cues to aid in the deception, too, such that the response is not entirely silent (wagging eyebrows or whatever).
How does that affect my relationship with my wife? We both have been able to be very honest with each other, and we have a relationship built strongly on trust and honesty. I hope I never break that because it would be a betrayal. It is really about the tone used to express the thought if the thought is important enough to express in the first place.
I despise the whole concept of "white lies". I despise people who dare to manipulate me, to condescendingly see after my own good or feelings by bald-face lying to me about something. Be honest or say nothing, but do not dare tell me excuses that are obvious lies, "socially acceptable". According to whom? Where do you draw the line between "white" and "black" lies? I do find it insulting, and I often do not mind calling people out on it; sure, things get uncomfortable, but they are the ones spouting deceit.
Perhaps it boils down to the notion that what somebody expresses is a measure of their integrity and honor. Somewhere I read a quote along the lines of... You can judge a man by two things: what he wants and what he is willing to do to get it.
With this policy, I have an awesome track record on my systems with regards to the number of "problems" that have installed themselves on my computer (number = zero, and I do not have AV installed, though I like to temporarily install several AVs and sanity check once every couple years or so; their overhead, constant updates, etc, just are not worth my time).
At one point I was trying to figure out how much I would enjoy Chrome, and one test I do with my applications is to have tcpdump in the background running while I run them. Whenever I went to any site, internal, external, or whatever, Chrome phones home to specific google sites. I think the published reason has to do with faster DNS lookups, but when I looked the sites up, they seemed attached to ad-related services. I searched around and could not find any setting to disable this feature. No, "Preferences > Under the Hood > Privacy" has nothing for disabling this feature. I think this phoning home was still there for Incognito mode, but time has left my memory fuzzy on that detail; Incognito mode is useless if you want to actually use cookies to maintain some session anyway, and why should I tell google about what accounts I hold across the net?
For the wiseguy who picks up on that last comment, my preference is Firefox with NoScript, AdBlock, and a disinclination for downloading sex.exe, so no, the common tracking systems do not know much about me. However, my ISP is quite familiar with my habits.
Someone recommended to me Chromium, claiming that it was stripped of this nonsense. So I tried that. Chromium did not phone home in my tests. It also lacked a few nice features that Chrome had, as if it were at least a version behind; I cannot remember what they were, only that at that point, I was sick of the hassle and ditched both pieces of software.
If you are concerned about apps phoning home, just run tcpdump/wireshark/whatever and watch. The extra paranoid will route their connections through a box with these tools.
My tests were within two months ago, so I feel the claim is pretty relevant.
If I have the time to dig up the article I am thinking about, I will add it to this post.
(Here is the HN thread on the contrastrebellion site: http://news.ycombinator.com/item?id=2807047)
macro do_in_reverse($value, @code) ...