13

And while we're at it, C11 adds some keywords like _Atomic as well. Is this the right way to submit requests for addition, or would it be better to ask for it in the 'Google Code Prettify' project?

EDIT: I checked the prettify source repository (read-only, svn revision 194), and would suggest to change the variable C_KEYWORDS in src/prettify.js, line 70, to:

var C_KEYWORDS = [FLOW_CONTROL_KEYWORDS,"auto,case,char,const,default," + 
    "double,enum,extern,float,goto,int,long,register,short,signed,sizeof," +
    "static,struct,switch,typedef,union,unsigned,void,volatile," +
    "_Alignas,_Alignof,_Atomic,_Bool,_Complex,_Generic,_Imaginary," +
    "_Noreturn,_Static_assert,_Thread_local,inline,restrict"];

Especially inline and restrict are omissions from C99.
If you wish, you might also include the more common variants (but formally not defined as keywords):

var C_KEYWORDS = [FLOW_CONTROL_KEYWORDS,"auto,case,char,const,default," + 
    "double,enum,extern,float,goto,int,long,register,short,signed,sizeof," +
    "static,struct,switch,typedef,union,unsigned,void,volatile," +
    "_Alignas,_Alignof,_Atomic,_Bool,_Complex,_Generic,_Imaginary," +
    "_Noreturn,_Static_assert,_Thread_local,inline,restrict," +
    "alignas,alignof,atomic,bool,complex,generic,imaginary," +
    "noreturn,static_assert,thread_local"];

Refer to the most recent C standard ISO/IEC 9899:2011 for details.

EDIT2: I sent an email to the author of prettify as well.

  • Can you link to some questions/answers that use these keywords? – Bill the Lizard Jan 24 '12 at 16:02
  • 1
    @BilltheLizard My own post :) stackoverflow.com/q/8989243/1029106 – Johan Bezem Jan 24 '12 at 16:05
  • "Is this the right way to submit requests for addition, or would it be better to ask for it in the 'Google Code Prettify' project?" Both! – Pollyanna Jan 24 '12 at 17:28
  • @AdamDavis It appears that you need a Google account to post in that forum, and also to generate a new issue. I do not have an account, so maybe someone with an account is kind enough to create an issue in the list. A list with all C and C++ keywords until C11 and C++11 can be found at my website, if necessary. – Johan Bezem Jan 24 '12 at 17:42
  • @BilltheLizard Email sent to Mike Samuel. – Johan Bezem Jan 25 '12 at 13:26
5

The right thing to do is:

  1. Submit a patch to the google-code-prettify project.

    One way to do this is to first edit the JavaScript live (e.g. in the Chrome Inspector), then open the relevant file under http://code.google.com/p/google-code-prettify/source/browse/trunk/src, click "Edit file", make the same change there, and submit it with an appropriate description.

  2. When that patch is accepted, request that prettify be updated on SE.

    This part you can do by posting a "question" here on meta.SO. Something like "Please update prettify to > r9000 so we can have proper spiky-hair support" might be a good title.

|improve this answer|||||

Not the answer you're looking for? Browse other questions tagged .