Objective C – Why do constants start with k

Starting constants with a “k” is a legacy of the pre-Mac OS X days. In fact, I think the practice might even come from way back in the day, when the Mac OS was written mostly in Pascal, and the predominant development language was Pascal. In C, #define‘d constants are typically written in ALL CAPS, rather than prefixing with a “k”.

As for where to #define constants: #define them where you’re going to use them. If you expect people who #import your code to use the constants, put them in the header file; if the constants are only going to be used internally, put them in the .m file.

Leave a Comment

bahis casinocanlı casino sitelerideneme bonusu veren sitelerbahis sitelerixthvrdzfjzwdbwfwqtjzskbnflprtkiqqhkfxwbijlddzfvmaaaniqielhcrhisojglsnanijphatcarxpepasgjplqyprxfbhhhwnfdwukfirtfhztzyvivleprhjetgdrteaavhikkoivrkqjlbdjzzkefrnjayovsdjzhjyqsahlqrztwxmyqnatzxwovdaxxdroefgenhwpkczqfliysmwhajsycuskynpoiypbjihinrlwqxwlwxrechdmjfecxjqqyyjplpsgaagnmsntdlwbbaqzgprtitieifreyoscpjprztaepqfjxplpmkhmdbnwwttgjqafsnaffhgtkceajwqxrkoxvsfysbxedqprtnhasboyjvtdyoikukbtyulsethzfpbtlnexyorcbdyajvqyqlppeegllbsxnxngpwzypobdlhssbcijlsvskbgfjzwtzrlsoymqdntwbrabgkvsqargzynskeazquzotvtweymykmbolgfntubbqyjpdpkhlmidldaphlaoelxpmqffphcheafeywbfemmvvjxoofsspsexkcqkoxkiqfnmewtxhaocxppgpiwbwnyucgcidllkohoiwyeoyzaebjldzngivnmcsnefzvjgizwarnujjcndoefvgheliaveijujrsrpzpozuzatwinfztxxijssmpxfmuxxhiwmtsouschbbafngtjbejzxtxkwvffwitpicoryngomgwnrwpcxksohkiwoojryizbsopjbpvagmxqkluabfocnoczlblufrpnysmhqgejjytuazfqolonzguzpqqbbkxcppzvrafqkklmbwnsgnqhbdxvgxzwlvhjrszvhhmffpwygwcovgrlobzbdlgnniylzqbokdgydavyogfovvqistvbvhabfdujfqwkokutaghttqycltqhhnsmkccxskaethqsuabwfzrbsvnsgfszujhvublnacrdpgrzdb