Return (value) Discussion ... (Message Type: Chat Record: Message Group: GroupAlumni)

xiaoxiao2021-03-06  61

User: 404082727 (Take the End of the World 2)

============================================================================================================================================================================================================= Message group: group / alumni (51) ======================================== ========== Message type: chat record =================================== ================

2004-12-05 12:36:53 / K Rain (9) INT TEST (INT I) {i ;}

INT main (void) {INT i = 0; for (i = 0; i <10; i ) {test (i);}}

Meaningful

2004-12-05 12:42:15 Take the end of the earth 2 () no meaning

2004-12-05 12:42:20 Walking the end of the earth 2 (7) is also wrong

2004-12-05 12:42:46 Walking the end of the earth 2 (7) return 0; the main function has not returned value

2004-12-05 12:43:13 Walking the End of the End 2 () Test

2004-12-05 12:48:54 Bucha () negligent. [: - |] However, this is just because someone is doing the optimized code, there is no meaning.

2004-12-05 12:55:10 / Kun Meteor Shower (4) Hehe

2004-12-05 12:56:01 Warming (16) Want to discuss: What is the meaning of the main function returns 0?

2004-12-05 12:56:46 Take the end of the earth 2 (4) The system can know that the program is ended.

2004-12-05 12:57:01 Warming (1) Return 1 is not the same normal end program?

2004-12-05 12:57:27 When the rain is found, I didn't see anything.

2004-12-05 12:58:16 floating) I am afraid no one is clear? SAD

2004-12-05 12:58:35 It doesn't matter in most cases. But the system can know if your program is wrong from this return value. General returnography is not. The not zero value represents an error code. The habit of UNIX

2004-12-05 13:00:04 Take the end of the earth 2 () really said that it is not very clear that you don't pay attention to this.

2004-12-05 13:00:17 This is the rain like this ... I think ... If there is a mistake in the program, there is no error, and I'm afraid it is over.

2004-12-05 13:02:12 Buch) but does not exclude the possibility of the last occurrence. It is said that it is normal to finally return 0, indicating normal. Otherwise, how do other programs know if you returned in the middle? 2004-12-05 13:02:52 Buch) For details, the return value is in Errorlevel

2004-12-05 13:05:15 Floating) If it is executed to occur in the middle, the accident end ... How do I know this error?

2004-12-05 13:06:14 Buchi) The simplest is to return a non-zero value. There are a small program under countless UNIX.

2004-12-05 13:09:33 floating) I still have a little doubt: Return 0 Return 1 is the last sentence of the program, whether this program is normal end or not normal, all execution processes have been implemented, and now tell System, what is it? What can I know how can I?

2004-12-05 13:10:58 Fishing 6) Buchi Automata big brother?

2004-12-05 13:10:59 Buch This is what people are told. If a program thinks 1 is an error, then it can be handled accordingly.

2004-12-05 13:11:19 LAZ is just the success of the program. System needs to know this

2004-12-05 13:12:12 Buch) Even if the system needs to know, there is also you to be.

2004-12-05 13:12:36 floating) I don't know how to set this East East

2004-12-05 13:13:02 Way) Perhaps Unix can, don't Windows?

2004-12-05 13:13:45 BUC) will depend on the needs. Windows can also, but it seems that there is not much person to use it.

2004-12-05 13:14:15 floating) strongly demand buchi automata big brother to speak

2004-12-05 13:14:38 BUC3) I don't make the program below Windows, so I don't know.

2004-12-05 13:16:08 Falling down ignition ing ... So how to deal with how to deal with the return non-0 value under UNIX, know the principle is ok.

2004-12-05 13:17:35 BUC) As for UNIX, I have already said. for example. For example, your program is killing a process: killprocess. Then you can call it under the shell: v = killprocessif (v == 1) Echo Successful Else Echo failed

2004-12-05 13:18:55 BUC is to say, what digital represents, and is determined by programmers. Nothing to say

2004-12-05 13:19:50 Warting) Work hard to understand ...

2004-12-05 13:21:30 Floating) V = KillProcessif (v == 1) Echo Successful Else Echo failed file: // Call a program, and call a function in the program No difference FILE: / / But this shell Is it like a programming environment?

2004-12-05 13:21:50 BUC) equivalent to the DOS window

2004-12-05 13:22:56 floating) is equivalent to the DOS window ---------------- 编 编 编 指,, observe the procedure results?

2004-12-05 13:23:01 / k The main function returns an integer value to the caller of the system. The system cannot ignore this return value, so "void main ()" is illegal in C and C.

2004-12-05 13:23:43 BU) The system can ignore this value. I don't know which book is said.

2004-12-05 13:23:46 The railing main function returns an integer value to the caller of the system. The system cannot ignore this return value, so "void main ()" is illegal in C and C ------------------------- Void MAIN () I remember the 2004-12-05 13:23:54 / ku) standard that can be written like this,

2004-12-05 13:24:22 Buchi What standards?

2004-12-05 13:24:34 / KUN stream In addition, pay attention to the C89 and ARM C standards, the type declaration of the main function is not allowed in ISO C and C99 standards.

2004-12-05 13:25:04 / KUN meteor does not allow the type statement of the main function

There must be a return value

2004-12-05 13:25:40 Buchi, C is it. But this is very systematic that it is independent of the return value. Language is language, system is system ha

2004-12-05 13:27:02 / kun stars

2004-12-05 13:27:13 / KUN stream can't understand, ding ,,,,,,,

2004-12-05 13:28:26 Just after the rain, I just thought of a question: Return 0; returnit 1; no matter what returned .. Signified normal exit or normal exit, we can see an explicit exit statement, and The error that truly causes the procedure from properly exiting is definitely a programmer, so it will definitely write a returna to place it, return a wrong point to the system.

2004-12-05 13:28:56 Buchi au actually understands: C standard defines the main function must return an int, but this is just a grammar. As for other programs, it is necessary to handle this return value, obviously not necessarily.

2004-12-05 13:30:11 How do you capture this error at this time?

2004-12-05 13:30:20 Buchi au is not necessarily. I can try {....} catch (exception e) {returnit 1;}. Don't do this. Besides, don't narrowly understand the system error. Not all errors cause an exception to exit.

2004-12-05 13:31:40 Buchi Authentic If the program is abnormal exits, the system often only gets an error message without a specific meaning. Description Your program is not good [: D]

2004-12-05 13:34:16 Waterfall, Haha, can you use an exception to exit when there is no serious to directly exit? If this error is serious to exit directly, you can only say that I wrote it well ------------------- Is this what I mean? Sadsadsad

2004-12-05 13:35:17 Buchi Au is just an example. There is no abnormality in the language level. Anyway procedure should try to handle various exceptions.

2004-12-05 13:36:55 Water season / benefit is not shallow ...

2004-12-05 13:37:43 When I wanted, I knew that the big brother was a hard hand. So I must pull it Ohh.

2004-12-05 13:37:55 When you wo, you will go to eat first.

2004-12-05 13:39:08 Buchi Autom [: $] award

转载请注明原文地址:https://www.9cbs.com/read-84446.html

New Post(0)