参考js0n.c
代码语法如下:
System Administrator
有人能解释一下这里做了什么吗?语法 static void *gostruct[] =
{
[0 ... 255] = &&l_bad,
['\t'] = &&l_loop, [' '] = &&l_loop, ['\r'] = &&l_loop, ['\n'] = &&l_loop,
['"'] = &&l_qup,
[':'] = &&l_loop, [','] = &&l_loop,
['['] = &&l_up, [']'] = &&l_down, // tracking [] and {} individually would allow fuller validation but is really messy
['{'] = &&l_up, ['}'] = &&l_down,
['-'] = &&l_bare, [48 ... 57] = &&l_bare, // 0-9
[65 ... 90] = &&l_bare, // A-Z
[97 ... 122] = &&l_bare // a-z
};
........
.......
l_bad:
*vlen = cur - json; // where error'd
return 0;
........
........
和
[0 ... 255]
在这做什么?
答案 0 :(得分:108)
Header 1 Header 2 Header 3 Normalized Status Match type
0 Boston Label 1 "phrase 1" phrase 1 eligible Phrase
1 DC/Baltimore Label 2 [phrase 2] phrase 2 eligible Exact
2 Philly/NJ Label 3 "phrase 3" phrase 3 eligible Phrase
3 Philly/NJ Label 4 "phrase 4" phrase 4 eligible Phrase
4 Philly/NJ Label 5 "phrase 5" phrase 5 eligible Phrase
5 Portland Label 6 "phrase 6" phrase 6 eligible Phrase
6 Raleigh/Charlotte Label 7 [phrase 7] phrase 7 eligible Exact
7 Raleigh/Charlotte Label 8 "phrase 8" phrase 8 eligible Phrase
0 Boston Label 1 +phrase +1 phrase 1 eligible Broad
1 Boston Label 1 [phrase 1] phrase 1 eligible Exact
2 DC/Baltimore Label 2 +phrase +2 phrase 2 eligible Broad
3 DC/Baltimore Label 2 "phrase 2" phrase 2 eligible Phrase
5 Philly/NJ Label 3 +phrase +3 phrase 3 eligible Broad
6 Philly/NJ Label 4 +phrase +4 phrase 4 eligible Broad
7 Philly/NJ Label 5 +phrase +5 phrase 5 eligible Broad
8 Philly/NJ Label 3 [phrase 3] phrase 3 eligible Exact
9 Philly/NJ Label 4 [phrase 4] phrase 4 eligible Exact
10 Philly/NJ Label 5 [phrase 5] phrase 5 eligible Exact
11 Portland Label 6 +phrase +6 phrase 6 eligible Broad
12 Portland Label 6 [phrase 6] phrase 6 eligible Exact
13 Raleigh/Charlotte Label 7 +phrase +7 phrase 7 eligible Broad
14 Raleigh/Charlotte Label 8 +phrase +8 phrase 8 eligible Broad
15 Raleigh/Charlotte Label 7 "phrase 7" phrase 7 eligible Phrase
16 Raleigh/Charlotte Label 8 [phrase 8] phrase 8 eligible Exact
是GCC提供的扩展
https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html#Designated-Inits
要将一系列元素初始化为相同的值,请写入
private int gvDataCount { get { object count = ViewState["gvDataCount"]; if (count == null) count = gvTest.PageSize; return Convert.ToInt32(count); } set { ViewState["gvDataCount"] = value; } } private void BindData() { //.... var list = items.Skip(gvTest.PageIndex * gvTest.PageSize).Take(gvTest.PageSize).ToList(); this.gvDataCount = list.Count; gvTest.DataSource = list; gvTest.VirtualItemCount = items.Count; gvTest.DataBind(); } protected void gvTest_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType != DataControlRowType.DataRow) return; if (e.Row.RowIndex > this.gvDataCount) e.Row.Visible = false; }
。这是一个GNU扩展。例如,...
[first ...
last] = value
是另一个扩展程序
https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html#Labels-as-Values
您可以获取当前函数中定义的标签的地址(或 包含函数)和一元运算符
int widths[] = { [0 ... 9] = 1, [10 ... 99] = 2, [100] = 3 };
。价值有 输入&&
。该值是常量,可以在任何地方使用 该类型的常量有效。例如:&&