批判 [英] Critique

查看:51
本文介绍了批判的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


哇,自从我向这个

组发布任何东西以来,已经很久了。我不再像过去那样保持现状;当我有空闲时,我只会潜伏在



我正在尝试编写程序来打开文件并处理它

根据命令行参数。我只需要两个简单的搜索

和替换操作。我用一个代表一个

站点代码的int和一个表示日期的长调用程序,我的程序应该用int替换

文件中的一些硬编码文本字符串我已经过了很长时间。我可能已经了解了为什么现在不能正常工作,但我会像这里的建设性批评一样。我试图遵循标准

(据我所知),但是,好吧,让我们看看它是怎么回事......感谢阅读!


Andrew

/ * SiteUpdate.c * /

#include< stdio.h>

#include< stdlib.h> ;

#include< string.h>


#define BUFSIZE 256

#define SITEMIN 0

#define SITEMAX 599

#define STARTDATE 20050401

#define ENDDATE 29991231

#define IN" SiteUpdate.sql"


int fgetline(FILE *,char *);


int main(int argc,char * argv [])

{

int rc = EXIT_FAILURE;

int site_code = SITEMIN - 1;

long date = STARTDATE - 1;


if(3 == argc)

{

site_code = atoi(argv [1]);

if(site_code< SITEMIN || SITEMAX< site_code)

{

fprintf(stderr,站点代码必须是%d和

%d.\ n之间的数字,SITEMIN,SITEMAX);

}

else

{

date = atol(argv [2]);

if(date<开始||结束<日期)

{

fprintf(stderr,"%s \ n","日期必须采用格式

\ YYYYMMDD \和之间的);

fprintf(stderr,"%s \ n","今天和12月31日,

2999。 ");

}

else

{

char * outfile,code [4];

FILE * in,* out;


sprintf(代码,"%d",site_code + 400);


/ *减去1表示网站 - > " XXX"和* /

/ *为NUL字符添加一个* /

outfile = malloc(strlen(IN) - 1 + 1);


if(outfile)

{

sprintf(outfile,"%sUpdate.sql",code);

in = fopen(IN," r");

out = fopen(outfile," w +");

if(in&& out)

{

char buf [BUFSIZE],* p;

char * temp;


while (EOF!= fgetline(in,buf))

{

if(buf == strstr(buf," - "))

{

/ *如果该行是评论,请不要* /

/ *将其包含在最终脚本中* /

继续;

}

else if((p = strstr(buf," xxx")))

{

temp = malloc(strlen(buf)+ 1);

if(temp)

{

/ * Replace" XXX"使用站点代码* /

strcpy(temp,buf);

sprintf(p,"%s",code);

strcat (buf,strstr(temp," xxx")

+ strlen(" xxx"));

fprintf(out,"%s \ n" ,buf);


免费(临时);

temp = NULL;

}

否则

{

fprintf(stderr,"%s \ n","还不够

memory。);

}

}

else if((p = strstr(buf,yyyyyyyy))



{

temp = malloc(strlen(buf)+ 1);

if(temp)

{

/ *替换yyyyyyyy带日期* /

strcpy(temp,buf);

sprintf(p,"%ld",date);

strcat( buf,strstr(temp,

" \\ gen"));

fprintf(out,"%s \ n",buf);


免费(临时);

temp = NULL;

}

其他

{

fprintf(stderr,"%s \ n","还不够

记忆。);

}

}

其他

{

/ *无事可做,只需复制行* /

fprintf(out,"%s \ nn",buf);

}

}

fclose(in);

fclose(out);

rc = EXIT_SUCCESS;

}

else

{

fprintf(stderr,无法打开%s!\ n,(在?

outfile:IN)); < br $>
}


免费(outfile);

}

}

}

}

其他

{

fprintf(s tderr," \ n");

fprintf(stderr," Usage:%s< site_code> < date> \ n",argv [0]);

fprintf(stderr,"%s \ n"," site_code两位数

代表网站);

fprintf(stderr,%s \ n,日期八位数日期

,格式为\YYYYMMDD \\ \\");

fprintf(stderr,"%c\ n",''\ n'');

fprintf(stderr," ;%s \ n","生成当月的SQL脚本。

输入文件为。\\SiteUpdate.sql");

}


返回rc;

}


int fgetline(FILE * fp,char * buf)

{

char * p;

int c,i = 0;


p = buf;

while(EOF!=(c = fgetc(fp))&&''\ n''!= c&& i< BUFSIZE)

{

* p = c;

++ p;

++ i;

}

* p = 0;

if((p = strchr(buf,''\ n'')))* p = 0;


返回c;

}


/ * end SiteUpdate.c * /

Hello all,

Wow, has it ever been a long time since I posted anything to this
group. I don''t keep as current as I used to anymore; I only lurk from
time to time when I have a spare moment.
I am trying to write a program to open a file and process it
according to command line parameters. All I need are two simple search
and replace operations. I invoke the program with an int representing a
site code and a long representing a date and my program should replace
some hard-coded text strings in the file with the int and the long I pass
in. I may have some insight as to why this is not working now, but I''d
like some constructive criticism here. I tried to conform to the standard
(as I know it), but, well, let''s see how it goes... Thanks for reading!

Andrew
/* SiteUpdate.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define BUFSIZE 256
#define SITEMIN 0
#define SITEMAX 599
#define STARTDATE 20050401
#define ENDDATE 29991231
#define IN "SiteUpdate.sql"

int fgetline ( FILE *, char * );

int main ( int argc, char *argv[] )
{
int rc = EXIT_FAILURE;
int site_code = SITEMIN - 1;
long date = STARTDATE - 1;

if ( 3 == argc )
{
site_code = atoi ( argv[1] );
if ( site_code < SITEMIN || SITEMAX < site_code )
{
fprintf ( stderr, "Site code must be a number between %d and
%d.\n", SITEMIN, SITEMAX );
}
else
{
date = atol ( argv[2] );
if ( date < STARTDATE || ENDDATE < date )
{
fprintf ( stderr, "%s\n", "Date must be in the format
\"YYYYMMDD\" and between" );
fprintf ( stderr, "%s\n", "today and December 31,
2999." );
}
else
{
char *outfile, code[4];
FILE *in, *out;

sprintf ( code, "%d", site_code + 400 );

/* subtract 1 for "site" -> "xxx" and */
/* add one for NUL character */
outfile = malloc ( strlen ( IN ) - 1 + 1 );

if ( outfile )
{
sprintf ( outfile, "%sUpdate.sql", code );
in = fopen ( IN, "r" );
out = fopen ( outfile, "w+" );
if ( in && out )
{
char buf[BUFSIZE], *p;
char *temp;

while ( EOF != fgetline ( in, buf ) )
{
if ( buf == strstr ( buf, "--" ) )
{
/* If the line is a comment, do not */
/* include it in the final script */
continue;
}
else if ( ( p = strstr ( buf, "xxx" ) ) )
{
temp = malloc ( strlen ( buf ) + 1 );
if ( temp )
{
/* Replace "xxx" with site code */
strcpy ( temp, buf );
sprintf ( p, "%s", code );
strcat ( buf, strstr ( temp, "xxx" )
+ strlen ( "xxx" ) );
fprintf ( out, "%s\n", buf );

free ( temp );
temp = NULL;
}
else
{
fprintf ( stderr, "%s\n", "Not enough
memory." );
}
}
else if ( ( p = strstr ( buf, "yyyyyyyy" ) )
)
{
temp = malloc ( strlen ( buf ) + 1 );
if ( temp )
{
/* Replace "yyyyyyyy" with date */
strcpy ( temp, buf );
sprintf ( p, "%ld", date );
strcat ( buf, strstr ( temp,
"\\gen" ) );
fprintf ( out, "%s\n", buf );

free ( temp );
temp = NULL;
}
else
{
fprintf ( stderr, "%s\n", "Not enough
memory." );
}
}
else
{
/* Nothing to do, just copy the line */
fprintf ( out, "%s\n", buf );
}
}
fclose ( in );
fclose ( out );
rc = EXIT_SUCCESS;
}
else
{
fprintf ( stderr, "Could not open %s!\n", ( in ?
outfile : IN ) );
}

free ( outfile );
}
}
}
}
else
{
fprintf ( stderr, "\n" );
fprintf ( stderr, "Usage: %s <site_code> <date>\n", argv[0] );
fprintf ( stderr, "%s\n", " site_code two digit number
representing the site" );
fprintf ( stderr, "%s\n", " date eight digit date
in the format \"YYYYMMDD\"" );
fprintf ( stderr, "%c\n", ''\n'' );
fprintf ( stderr, "%s\n", "Generates a SQL script for the month.
Input file is .\\SiteUpdate.sql" );
}

return rc;
}

int fgetline ( FILE *fp, char *buf )
{
char *p;
int c, i = 0;

p = buf;
while ( EOF != ( c = fgetc ( fp ) ) && ''\n'' != c && i < BUFSIZE )
{
*p = c;
++p;
++i;
}
*p = 0;
if ( ( p = strchr ( buf, ''\n'' ) ) ) *p = 0;

return c;
}

/* end SiteUpdate.c */

推荐答案

Andrew Clark写道:
Andrew Clark wrote:

哇,自从我向这个
小组发布任何内容以来,它已经很久了。我不再像过去那样保持现状;我只是潜伏时间,当我有空闲时刻。

我正在尝试编写程序来打开文件并根据命令行参数处理它。我只需要两个简单的搜索和替换操作。我使用int
代表一个站点代码调用程序,一个long表示一个日期,我的
程序应该替换文件中的一些硬编码文本字符串
用int和long I传入。我可能有一些见解,为什么现在不能正常工作,但我想在这里提出一些建设性的批评。我试图符合标准(我知道它),但是,好吧,让我们看看它是怎么回事...感谢阅读!

Wow, has it ever been a long time since I posted anything to this
group. I don''t keep as current as I used to anymore; I only lurk
from time to time when I have a spare moment.

I am trying to write a program to open a file and process it
according to command line parameters. All I need are two simple
search and replace operations. I invoke the program with an int
representing a site code and a long representing a date and my
program should replace some hard-coded text strings in the file
with the int and the long I pass in. I may have some insight as
to why this is not working now, but I''d like some constructive
criticism here. I tried to conform to the standard (as I know
it), but, well, let''s see how it goes... Thanks for reading!




从根本上说,你试图把太多的东西塞进一个例行程序中,主要是。

如果你打破行动,情况会更清楚。你的
getline是朝着正确的方向迈出的一步。


但是有可用的代码几乎完全按照你想要的b $ b想要的。看看我的网站上的ggets和id2id-20。 id2id将

如果你写一个两行配置文件来提供你的工作

替换xxx和yyyyyyyy,但这可能不太好

适合。无论如何,便携式信号源都在那里,您可以轻松地将其更改为命令行参数。请参阅:


< http://cbfalconer.home.att.net/download/>


-

"如果您想通过groups.google.com发布跟进,请不要使用

破损的回复链接在文章的底部。点击

" show options"在文章的顶部,然后点击

回复在文章标题的底部。 - Keith Thompson



Fundamentally you try to cram too much into one routine, main.
Things will be much clearer if you break operations up. Your
getline is a step in the right direction.

However there is available code to do almost exactly what you
want. Take a look on my site for ggets and id2id-20. id2id will
do your job if you write a two line configuration file to supply
the replacements for xxx and yyyyyyyy, but this may not be quite
suitable. At any rate the portable source is there, and you can
easily change it to work from command line parameters. See:

<http://cbfalconer.home.att.net/download/>

--
"If you want to post a followup via groups.google.com, don''t use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson


Andrew Clark在11/04/05写道:

一些评论(-ed-)。请随时询问详细信息:


字符串检测:在''sys.h'中定义
http://mapage.noos.fr/emdel/clib/ed/inc/sys.h

#include< stdio.h>

#include< stdlib.h>

#include< string.h>


#define BUFSIZE 256

#define SITEMIN 0

#define SITEMAX 599

#define STARTDATE 20050401L < br $>
#define ENDDATE 29991231L

/ * -ed-某些系统仅限于8.3文件名格式* /

#define IN_BEGSITE

#define IN_END" UP~1.SQL"

#define IN_" ../ data /" IN_BEG IN_END


int fgetline(FILE *,char *);

/ * -ed-避免使用更好的布局分离原型... * /


int main(int argc,char * argv [])

{

int rc = EXIT_FAILURE;

int site_code = SITEMIN - 1;

long date = STARTDATE - 1;


if(3 == argc)

$

/ * -ed-


site_code = atoi(argv [1]);


* atoi()已弃用。使用strtol()

*这是一种天真的方式。

*应该改进字符集控制,

*结束指针检查,范围值等。

* /

site_code =(int)strtol(argv [1],NULL,10);


if(site_code< SITEMIN || SITEMAX< site_code)

{

fprintf(stderr,站点代码必须是%d和
之间的数字
%d。\ n",SITEMIN,SITEMAX);

}

else

{

date = strtol(argv [2],NULL,10);

if(date< STARTDATE || ENDDATE< date)

{

fprintf(stderr,"%s \ n"," Date必须采用格式

\" YYYYMMDD \"以及&););

fprintf(stderr,"%s \ n","今天和2999年12月31日。");

/ * -ed-

*今天的东西没有经过测试...... STARTDATE应该是一个

计算变量...

* /

}
else

{

char * outfile,code [4];

FILE * in,* out; < br $>

LIM_STR(代码);

sprintf(代码,"%d",site_code + 400);

CHK_STR(代码);

/ * -ed- 599 + 400 = 999.好的。 * /


/ *减去1为site - > " XXX"和* /

/ *为NUL字符添加一个* /

outfile = malloc(strlen(IN_) - 1 + 1);

/ * -ed-

*请求的尺寸最终应该存储在某个地方以便进一步控制......

*

*也就是说,除非你打算重新分配数组,否则这里不需要
malloc()

*因为大小是编译时间/>
*常数,如果由''sizeof IN - 1'表示,IN为

字符串

*字面值。

*

*当然,如果它变成一个变量(字符串数组),

它是一个不同的故事。

*。

*

*数组就足够了。

* /


if(outfile)

/ * -ed- if(outfile!= NULL)更清楚... * /

{

sprintf(outfile,"%) s" IN_END,code);

in = fopen(IN_," r");

/ * -ed-不需要w +。使用w或a。 * /

out = fopen(outfile," w");

if(in&& out)

{

char buf [BUFSIZE],* p;

char * temp;


LIM_STR(buf);


while(EOF!= fgetline(in,buf))

/ * -ed- BAD!你重新发明了gets()bug。

*你错过了构建一个

实体的机会

*读取线功能灵活的界限

检查。


while(EOF!= fgetline(in,buf,sizeof buf))


* /


{

if(buf == strstr(buf," - "))

{

/ *如果该行是注释,请不要* /

/ *在最终脚本中包含它* /

continue;

}

else if((p = strstr(buf," xxx"))!= NULL)

{

/ * -ed-

*为什么临时的定义不在这里?

*范围缩小使得代码更多

可读,

*更安全,并准备模块化。

* /


size_t size = strlen(buf) + 1;

temp = malloc(size);

if(temp)

{

LIM_PTR(temp ,尺寸);

/ *替换xxx使用网站代码* /

strcpy(temp,buf);

CHK_PTR(临时,大小);


/ * - ed-

*您应该考虑为这些动态字符串副本构建一些

str_dup()

*函数。

* /


sprintf(p,"%s",代码);

/ * -ed-非常可疑缺少约束

cheking ... * /

CHK_STR(buf);


strcat(buf,strstr(temp," xxx")+ strlen

(" xxx"));

/ * -ed- ditto ... * /

CHK_STR(buf);


fprintf(out,"%s \ nn",buf);


免费(临时);

temp = NULL;

}

else

{

fprintf(stderr,"%s \\ \\ n","还不够

记忆。);

}

}

else if ((p = strstr(buf,yyyyyyyy))!= NULL)

{

size_t size = strlen(buf)+ 1;

temp = malloc(size);

if(temp)

{

LIM_PTR(临时,大小);


/ *替换yyyyyyyy ;带日期* /

strcpy(temp,buf);

CHK_PTR(临时,大小);


sprintf(p, "%ld",date);

CHK_STR(buf);


strcat(buf,strstr(temp," \\ gen" ));

CHK_STR(buf);


fprintf(out,"%s \ n",buf);


free(temp);

temp = NULL;

}

else

{

fprintf(stderr,"%s \ n",不够

记忆。;

}

}

其他

{

/ *无事可做,只需复制一行* /

fprintf(out,"%s \ nn",buf);

}

}

fclose(in);

fclose(out);

rc = EXIT_SUCCESS;

}

else

{

fprintf(stderr,无法打开%s!\ n"

,(in?outfile:IN_));

}


免费(outfile);

}

}

}

}

其他

{

fprintf(stderr," \ n") ;

fprintf(stderr,用法:%s< site_code> < date> \ n",argv [0]);

fprintf(stderr,"%s \ n"," site_code两位数

代表网站);

fprintf(stderr,%s \ n,日期八位数日期

,格式为\YYYYMMDD \\ \\");

fprintf(stderr,"%c\ n",''\ n'');

fprintf(stderr," ;%s \ n","生成当月的SQL脚本。

输入文件为。\\SiteUpdate.sql");

}


返回rc;

}


int fgetline(FILE * fp,char * buf)

{

char * p;

int c,i = 0;


p = buf;

while(EOF!=(c = fgetc(fp))&&''\ n''!= c&& i< BUFSIZE)

{

* p = c;

++ p;

++ i;

}

* p = 0;

if((p = strchr(buf,'') \\ n''))!= NULL)

{

* p = 0;

}

/ * -ed-你对待处理的角色做什么? * /

返回c;

}


-

Emmanuel

C-FAQ: http:// www .eskimo.com / ~scs / C-faq / faq.html

C库: http://www.dinkumware.com/refxc.html


有10种类型的人在今天的世界;

那些了解二元的人,以及那些不懂的人。

Andrew Clark wrote on 11/04/05 :
Some comments (-ed-). Feel free to ask for details :

string instrumentation : defined in ''sys.h'' at
http://mapage.noos.fr/emdel/clib/ed/inc/sys.h
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define BUFSIZE 256
#define SITEMIN 0
#define SITEMAX 599
#define STARTDATE 20050401L
#define ENDDATE 29991231L

/* -ed- some system are limited to the 8.3 file name format */
#define IN_BEG "SITE"
#define IN_END "UP~1.SQL"
#define IN_ "../data/" IN_BEG IN_END

int fgetline (FILE *, char *);
/* -ed- avoid separated prototypes with a better layout... */

int main (int argc, char *argv[])
{
int rc = EXIT_FAILURE;
int site_code = SITEMIN - 1;
long date = STARTDATE - 1;

if (3 == argc)
{
/* -ed-

site_code = atoi (argv[1]);

* atoi() is deprecated. Use strtol()
* here is a naive way.
* Should be improved for character set control,
* end pointer checking, range value etc.
*/
site_code = (int) strtol (argv[1], NULL, 10);

if (site_code < SITEMIN || SITEMAX < site_code)
{
fprintf (stderr, "Site code must be a number between %d and
%d.\n", SITEMIN, SITEMAX);
}
else
{
date = strtol (argv[2], NULL, 10);
if (date < STARTDATE || ENDDATE < date)
{
fprintf (stderr, "%s\n", "Date must be in the format
\"YYYYMMDD\" and between");
fprintf (stderr, "%s\n", "today and December 31, 2999.");
/* -ed-
* The ''today'' thing is not tested... STARTDATE should be a
calculated variable ...
*/
}
else
{
char *outfile, code[4];
FILE *in, *out;

LIM_STR (code);
sprintf (code, "%d", site_code + 400);
CHK_STR (code);
/* -ed- 599 + 400 = 999. OK. */

/* subtract 1 for "site" -> "xxx" and */
/* add one for NUL character */
outfile = malloc (strlen (IN_) - 1 + 1);
/* -ed-
* the requested size should eventually
* be stored somewhere for further controls...
*
* That said, unless you intent to realloc the array,
malloc()
* is not necessary here because the size is a compile-time
* constant if expressed by ''sizeof IN - 1'', IN being a
string
* literal.
*
* Of course, if it becomes a variable (array of string),
it''s
* a different story.
*
* An array would suffice.
*/

if (outfile)
/* -ed- if (outfile != NULL) is clearer... */
{
sprintf (outfile, "%s" IN_END, code);
in = fopen (IN_, "r");
/* -ed- no need for "w+". Use "w" or "a". */
out = fopen (outfile, "w");
if (in && out)
{
char buf[BUFSIZE], *p;
char *temp;

LIM_STR (buf);

while (EOF != fgetline (in, buf))
/* -ed- BAD! You have reinvented the gets() bug.
* You have missed the opportunity to build a
solid
* read line function with flexible bound
checking.

while (EOF != fgetline (in, buf, sizeof buf))

*/

{
if (buf == strstr (buf, "--"))
{
/* If the line is a comment, do not */
/* include it in the final script */
continue;
}
else if ((p = strstr (buf, "xxx")) != NULL)
{
/* -ed-
* why is the definiton of ''temp'' not here ?
* Scope reduction makes the code more
readable,
* more safe, and prepare it to modularization.
*/

size_t size = strlen (buf) + 1;
temp = malloc (size);
if (temp)
{
LIM_PTR (temp, size);
/* Replace "xxx" with site code */
strcpy (temp, buf);
CHK_PTR (temp, size);

/* -ed-
* you should consider to build some
str_dup()
* function for these dynamic string copies.
*/

sprintf (p, "%s", code);
/* -ed- Very suspicious lack of bound
cheking... */
CHK_STR (buf);

strcat (buf, strstr (temp, "xxx") + strlen
("xxx"));
/* -ed- ditto... */
CHK_STR (buf);

fprintf (out, "%s\n", buf);

free (temp);
temp = NULL;
}
else
{
fprintf (stderr, "%s\n", "Not enough
memory.");
}
}
else if ((p = strstr (buf, "yyyyyyyy")) != NULL)
{
size_t size = strlen (buf) + 1;
temp = malloc (size);
if (temp)
{
LIM_PTR (temp, size);

/* Replace "yyyyyyyy" with date */
strcpy (temp, buf);
CHK_PTR (temp, size);

sprintf (p, "%ld", date);
CHK_STR (buf);

strcat (buf, strstr (temp, "\\gen"));
CHK_STR (buf);

fprintf (out, "%s\n", buf);

free (temp);
temp = NULL;
}
else
{
fprintf (stderr, "%s\n", "Not enough
memory.");
}
}
else
{
/* Nothing to do, just copy the line */
fprintf (out, "%s\n", buf);
}
}
fclose (in);
fclose (out);
rc = EXIT_SUCCESS;
}
else
{
fprintf (stderr, "Could not open %s!\n"
,(in ? outfile : IN_));
}

free (outfile);
}
}
}
}
else
{
fprintf (stderr, "\n");
fprintf (stderr, "Usage: %s <site_code> <date>\n", argv[0]);
fprintf (stderr, "%s\n", " site_code two digit number
representing the site");
fprintf (stderr, "%s\n", " date eight digit date
in the format \"YYYYMMDD\"");
fprintf (stderr, "%c\n", ''\n'');
fprintf (stderr, "%s\n", "Generates a SQL script for the month.
Input file is .\\SiteUpdate.sql");
}

return rc;
}

int fgetline (FILE * fp, char *buf)
{
char *p;
int c, i = 0;

p = buf;
while (EOF != (c = fgetc (fp)) && ''\n'' != c && i < BUFSIZE)
{
*p = c;
++p;
++i;
}
*p = 0;
if ((p = strchr (buf, ''\n'')) != NULL)
{
*p = 0;
}
/* -ed- What are you doing with the pending characters ? */
return c;
}

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

"There are 10 types of people in the world today;
those that understand binary, and those that dont."


Emmanuel Delahaye写道:
Emmanuel Delahaye wrote:
int fgetline(FILE *,char *);
/ * -ed-避免使用更好的布局分离原型... * /
int fgetline (FILE *, char *);
/* -ed- avoid separated prototypes with a better layout... */




有人同意这个观点吗?在

的顶部有一个单独的原型,一个文件减轻了我必须按特定顺序安排我的功能

实施的负担;更具体地说,它允许我

总是将main()作为第一个函数。为此,我愿意以小而无害的冗余形式支付

的价格。

Christian



Does anyone agree with this notion? Having separate prototypes at the top of
a file relieves me of the burden of having to arrange my function
implementations in a specific order; more specifically, it allows me to
always have main() as the first function. For that, I am willing to pay a
price in the form of a small, innocuous redundancy.
Christian


这篇关于批判的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆