Why do Objective-C files use the .m extension?

Why do Objective-C files use the .m extension?

Today most people would refer to them as method files, but

The .m extension originally stood for
messages when Objective-C was first
introduced, referring to a central
feature of Objective-C […]

(from the book Learn Objective-C on the Mac by Mark Dalrymple and Scott Knaster, page 9)

EDIT: To satisfy an itch I emailed Brad Cox, the inventor of Objective-C, about the question and he answered with this single line:

Because .o and .c were taken. Simple
as that.

Heres the email as visual proof:


It stands for methods. From the comp.lang.objective-C FAQ:

The organisation of Objective-C source is typically similar to that of C or C++ source code, with declarations and object interfaces going into header files named with a .h extension, and definitions and object implementations going in files named with a .m (short for methods) extension.

Why do Objective-C files use the .m extension?

.m files contain the (m)ethods. Possible reason?

Leave a Reply

Your email address will not be published.