Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!hellgate.utah.edu!dog.ee.lbl.gov!ucbvax!UCLAMVS.BITNET!EGC4MV2 From: EGC4MV2@UCLAMVS.BITNET (2 Michael Van Norman) Newsgroups: comp.lang.asm370 Subject: Re: Re: why code in 370 Assembler Message-ID: <9104241700.AA04584@ucbvax.Berkeley.EDU> Date: 24 Apr 91 16:55:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: IBM 370 Assembly Programming Discussion List Distribution: inet Organization: The Internet Lines: 29 > I think the point about the MVC instructions is being missed. The point is > that to copy a fixed length character string (assuming that all definitions > are properly made), then: > MVC TO,FROM in BAL is clear > TO = FROM; in various HLL's is clearer and machine independent > memcpy(TO,FROM,sizeof(TO)); in C is very ugly and hard to read On the contrary I find this very easy to read. In fact the memcpy statement is no different from the MVC statement except for the addition of the length parameter. The only real addition is the parenthesis. Take the ()'s out and you have MVC TO,FROM memcpy TO,FROM,LENGTH This looks the same to me :) As for TO = FROM, if the memory to be copied is a structure the TO = FROM will work in ANSI C. > The C compiler may generate a single MVC, but it's harder to write and read > then assembler in this case. Many other things in C require jumping thru > hoops to accomplish simple tasks and therefore make programs hard to read. You could always just #define MVC(x,y) memcpy(x,y,sizeof(x)) Then you could write MVC(TO,FROM) all you want! Michael Van Norman 11334 University Research Library Programmer/Analyst 405 Hilgard Avenue Library Administrative Computing Los Angeles, CA 90024-1575 EGC4MVN@mvs.oac.ucla.edu (213)825-1206