17

I was completely surprised that the following snippet compiled and worked in both Visual Studio 2008 and G++ 4.4.

The following code does not compile:

By coding rigidly to the spec, you can be certain that your code will compile and run without modification on any system with a compliant C++ compiler.

Those are excerpts from Stack Overflow. I've been noticing this pattern and I was wondering if it's semantically correct.

What I assume to be correct are expressions like "is/was/has/been compiled", "gets compiled". I rarely see them, though.

It gets compiled and runs but the output is...

I need my code to do different things based on the operating system on which it gets compiled.

The definition of compile doesn't back up the sentences I mentioned first.

  • to change the language in which a computer program is written into instructions that a computer can use

  • convert into a machine code or lower-level form in which the program can be executed.

To me, a code snippet can be compiled (by a compiler), but it can't compile. What would it mean?

  • is compiled, not gets compiled. – Lambie Aug 11 '19 at 16:44
  • @Lambie can't get replace be (= is ) here? – Andrew Tobilko Aug 12 '19 at 9:04
  • Not really. Because get would mean become there and you wouldn't say: the code becomes compiled, would you? It is or is not compiled at some point or by something. Not unless you were saying: The code got [became] compiled by mistake and should not have been part of the task. – Lambie Aug 12 '19 at 17:01
40

Both usages are now valid.

It is possible for a verb to develop meanings and, in particular, it can develop an intransitive sense from a transitive one. If you went back and talked to people in the 1940s, then "compile" didn't have anything to do with electronic computers. It just meant "assemble information"

In the 1950s and 60s the meaning "convert source to machine code" and was used transitively. More recently an intransitive form has developed, meaning "to be successfully converted to machine code"(wiktionary sense 4). In this sense it is still more like computer jargon.

This type of verb is called an ergative verb. When used transitively it has an active meaning. When used intransitively it has a passive meaning.

For example "Bend" is another ergative verb:

I bent the iron bar.

The iron bar bent.

You should compare the intransitive form with the passive, which has an implied but unspecified actor.

The iron bar was bent (by someone).

Similarly there is a difference in meaning:

This code compiles = It can be converted to machine form

This code was compiled = Someone converted this code to machine form (the passive form has an implied but unspecificed actor)

| improve this answer | |
  • 3
    I normally take the intransitive sense to mean not capability but actual action. Did the code compile? Is the code compiling? The use of the code compiles is ambiguous. It can mean either the code can compile or the code compiles itself. – Jason Bassford Aug 9 '19 at 14:30
  • 9
    What does "the code compiles itself" even mean? Code doesn't have some sort of self-awareness which automatically transforms itself into a different form. "Did the code compile?" means "Did somebody successfully compile it?" "Is the code compiling?" means "Has the compilation process been started but is not yet finished?" (The complete process of building a large software system can take several hours). – alephzero Aug 9 '19 at 17:22
  • 4
    @alephzero It's common to anthropomorphize computers, robots, and computer programs, even though they're not actually self-aware. We regularly describe the results of a compute program as if the program had intentionally produced those results. E.g. you click the "Send" button and Gmail sends the mail. – Barmar Aug 9 '19 at 17:36
  • 7
    @JasonBassford that's pretty common. If I said "the door locks", I (almost always) mean that the door is capable of locking. If I said "the door locked", I mean that the door changed from an unlocked to a locked state. – Arcanist Lupus Aug 9 '19 at 19:01
  • 8
    @JasonBassford "The door locks", "the window opens", "the engine runs", etc., are perfectly natural and correct uses of the present tense to indicate habitual behaviour. Your suggestion that there is something wrong or even unusual about this usage is completely nonstandard. And, unless you're using a sentence such as "When you turn the key clockwise, the door locks", it seems much more likely that you'd say "The door is locking" to indicate something that's happening right now, or even "The door locked", since it happens so quickly that you're unlikely to announce it while it's happening. – David Richerby Aug 10 '19 at 12:57
3

Following up on the comments to JamesK's answer:

"The iron bar bent" is actually a really great analogy. Both "bent" and "compiled" can be used either transitively or intransitively to describe actual action:

The wrench bent the iron bar. — GCC compiled the code.

The iron bar bent. — The code compiled.


Like almost any English verb, both "bend" and "compile" can also be used to describe that some physical action is possible, without necessarily implying that the action was ever specifically carried out:

Wrenches can bend iron bars. — GCC can compile code.

Wrenches bend iron bars. — GCC compiles code.

This particular iron bar can be bent with a wrench. — This particular code can be compiled with GCC.

A wrench easily bends this particular iron bar. — GCC compiles this particular code.

In the last one, I had to cheat a little bit: "A wrench bends this iron bar" is probably grammatical, but it doesn't read to me like something a native speaker would actually say. (Notice also that the beneficiary of the "ease" is the person wielding the tool, not the tool itself. So in the same sense we might indeed say "GCC easily compiles this code," versus "GCC will compile this code, but only with difficulty" — like maybe it takes a few seconds to produce the object file.)


Finally, there's some discussion in the comments about who-or-what is properly doing the action, when a person directs the action but a tool executes it.

I bent the iron bar [using the wrench]. — I compiled the code [using GCC].

The wrench bent the iron bar. — GCC compiled the code.

I am fairly certain that this is a question of philosophy, not of grammar. Compare

John killed the old lady with a knife. — John's knife *killed the old lady.

A stray bullet from John's gun killed the old lady. — A stray bullet from John's gun *murdered the old lady.

My wrench bent the iron bar. — My mitt *caught the baseball.

Some actions can be intuitively attributed to inanimate tools; some actions intuitively require agency. Some, like "killed," seem to be in a gray area requiring some agency but not necessarily a whole person's worth. "Compiled" seems to be far, far on the "no agency required" side of the spectrum.


Notice that our "wrench" analogy isn't quite exact, for at least two reasons:

  • When you bend an iron bar using a wrench, the outcome depends not just on the wrench but also on your own physical strength. "A wrench bends this iron bar" is frequently dependent on the observer: it may be true for me and false for you (or vice versa). On the other hand, "GCC compiles this code" is rarely dependent on the observer. It'd be much more like saying "The Nargesa MT500A bends this iron bar" — a statement that can be verified by any observer with access to the tool.

  • Iron bars are rivalrous goods — once I've bent this particular iron bar, it's bent forever, and you have to go get a different iron bar if you want to bend one. Code is non-rivalrous — I can compile this particular piece of code, and then you can also compile it on your machine and we can compare answers. So maybe a tighter analogy to "GCC compiles this particular code" would be "The Nargesa MT500A bends this particular alloy."

| improve this answer | |
  • "GCC compiles this code" is rarely dependent on the observer — of course it may be dependent on things like version-of-GCC and even your operating system. If I say "GCC 4.6.4 compiles this code," that's really unlikely to be dependent on the observer. – Quuxplusone Aug 10 '19 at 15:52
3

The following code does not compile

It's just as valid as "The dynamite does not explode" and "the car does not run".

Why doesn't the dynamite explode? Because it's defective.

Why doesn't the code compile? Because it's defective.

Why doesn't the car run? Because it's defective.

What I assume to be correct are expressions like "is/was/has/been compiled", "gets compiled". I rarely see them, though.

What you assume to be correct is as correct as "The following code does not compile". It's used in different circumstances and seems a bit more passive.

To me, a code snippet can be compiled (by a compiler), but it can't compile. What would it mean?

It means we're lazy and prefer to say "the code didn't compile" instead of "the compiler unsuccessfully attempted to convert the source code into machine code".

| improve this answer | |
  • "the code didn't compile" and "the code wasn't compiled" Which, in your opinion, is more common? – Andrew Tobilko Aug 11 '19 at 15:55
  • @AndrewTobilko "the code didn't compile". While "the code wasn't compiled" is also grammatically correct, I just never (or veeerrry) rarely see it used. – RonJohn Aug 11 '19 at 16:37
  • 4
    Notice that "the code didn't compile" means "I tried to compile it and the compilation failed"; whereas "the code wasn't compiled" means "the code was never compiled (most likely, because nobody even tried to compile it)." Again it's the exact same difference as between "the iron bar didn't bend" and "the iron bar wasn't bent." – Quuxplusone Aug 11 '19 at 19:05
  • @AndrewTobilko: "this code wasn't compiled" might get used when talking about a build script that forgot to name one of the source files, resulting in for example a link error, or a program that doesn't include an accelerated version of some function. (e.g. left out the hand-written x86 asm version of something that overrides the portable version. Except that assembly language code is assembled, not compiled.) – Peter Cordes Aug 11 '19 at 19:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.