News for hackers. Stuff that matters.
Re:Notes on Programming in C (1989) by smhenderson on Wednesday October 04, 2017 @01:46PM (#15402446)
I always read that as the default behaviour for the language. C is usually compiled but there are exceptions. Perl (<=5) is almost always interpreted but there are tools to turn Perl code into an executable. I agree it's a somewhat arbitrary distinction given the above but when I first learned any programming at all having it explained this way helped my understanding of how languages can differ from each other.
Re:Notes on Programming in C (1989) by smitherfield on Wednesday October 04, 2017 @02:02PM (#15402639)
>Perl (<=5) is almost always interpreted but there are tools to turn Perl code into an executable.

IIRC those tools (of which similar ones exist for Java, Python, Ruby, Node.js, Lua and so on) just package together the sources (precompiled to bytecode) and an instance of the Perl[5] interpreter.

Re:Notes on Programming in C (1989) by sigjuice on Wednesday October 04, 2017 @02:30PM (#15403012)
Here's Java getting compiled to actual x86-64 code (mov $0x2a,%edx; add %edx,%eax).

  $ cat FortyTwo.java 
  public class FortyTwo
  {
          public static int fortytwo(int x) {
          	return x + 42;
          }
  }
  
  $ gcj-4.9 -c FortyTwo.java 
$ objdump -S FortyTwo.o

  FortyTwo.o:     file format elf64-x86-64
   
   
  Disassembly of section .text:

  <snip>
    
  0000000000000022 <_ZN8FortyTwo8fortytwoEJii>:
  {
          public static int fortytwo(int x) {
          	return x + 42;
    22:	55                   	push   %rbp
    23:	48 89 e5             	mov    %rsp,%rbp
    26:	48 83 ec 20          	sub    $0x20,%rsp
    2a:	89 7d ec             	mov    %edi,-0x14(%rbp)
    2d:	b8 00 00 00 00       	mov    $0x0,%eax
    32:	48 89 c7             	mov    %rax,%rdi
    35:	b8 00 00 00 00       	mov    $0x0,%eax
    3a:	e8 00 00 00 00       	callq  3f <_ZN8FortyTwo8fortytwoEJii+0x1d>
    3f:	8b 45 ec             	mov    -0x14(%rbp),%eax
    42:	89 45 fc             	mov    %eax,-0x4(%rbp)
    45:	8b 45 fc             	mov    -0x4(%rbp),%eax
    48:	ba 2a 00 00 00       	mov    $0x2a,%edx
    4d:	01 d0                	add    %edx,%eax
    4f:	c9                   	leaveq 
    50:	c3                   	retq
Re:Notes on Programming in C (1989) by smhenderson on Thursday October 05, 2017 @08:59AM (#15408753)
I also remember tools that simply converted Perl code to C. The argument against being that the advantages of an executable would be outweighed by the disadvantages of transpiled C being very inefficient.
Re:Notes on Programming in C (1989) by sigjuice on Thursday October 05, 2017 @05:38PM (#15412771)
"Transpile" is not a real and meaningful word. Can we stop using it please? Btw, if you have relevant citations stating otherwise (Wikipedia isn't it), I am happy to be proven wrong. Thanks!