Path: csiph.com!feeder.erje.net!2.us.feeder.erje.net!news.glorb.com!Xl.tags.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 13 May 2016 17:19:46 -0500 Subject: Re: WHOA! Microsoft strikes again... References: <3j60ib5a2mdabev612l204nh3oiop15mc6@4ax.com> <7793805c-5298-4d5d-ad51-b6f7c2e86e73@googlegroups.com> <6d4f8841-e0a2-4ff0-88e0-2c51f9b38329@googlegroups.com> <7qKdncDNyYHRzK7KnZ2dnUU7-XvNnZ2d@supernews.com> Newsgroups: sci.electronics.design From: Phil Hobbs Message-ID: <57365301.1040805@electrooptical.net> Date: Fri, 13 May 2016 18:19:45 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Lines: 90 X-Trace: sv3-npGQWLONWSR5Mb+CIcH3HACTNgF3D17euRXCxqyr+qJo3/GayDunGBwWYRGQyixxPzSG6TbLgTkba2G!kVIfBJ7ld2LqTNLLm3TTXKi10fwRZeal2ztqBzfzrvzCKDINXQSCtwz1pgHxwsNgisV5uA0= X-Complaints-To: www.supernews.com/docs/abuse.html X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 5037 Xref: csiph.com sci.electronics.design:411838 On 05/13/2016 04:56 PM, Jasen Betts wrote: > On 2016-05-13, Phil Hobbs wrote: >>> >>> makes no difference. >>> >>>> I use the normal argc/argv mechanism in programs that run on both Linux (gcc) >>>> and Windows (Visual Studio), and have never had to change that part of the >>>> code for Windows. >>> >>> You get half-arsed argv[] supprt on windows, it's good enough >>> for more than 90% of use cases. >> >> That's completely different from your first story, where you claimed >> that there was only a single string. That is clearly false. > > Here microsoft explains how argv is formed from a single string > https://msdn.microsoft.com/en-us/library/17w5ykft.aspx > resumably that is the the single string that createprocess receives as > commandline. So? Where does it say that there's only one string? The sample code loops for (count = 0; count < argc; count++) which looks pretty vanilla C to me. The rest of the article is mostly about reserved characters, which are indeed different between OSes, but that's far from a "single string". > >>> Try writing a work-alile for or printf(1), watch, tr, grep or sed where >>> you can expect the user to want to use arbitrary symbols (and control >>> characters) in the arguments. >> >> You can print anything with printf, using the "%c" format specifier. >> The others are application programs, not part of the OS. > > they are _all_, application programs, printf(1) means /usr/bin/printf We're talking about C programming, or we were until you started trying to move the goal posts. Good luck referencing argv[] from printf(1). > > it seems to be more a limitation of the shell, than windows itself, Sure. I'm not trying to bust your stones, just to get to the root of the matter. > > >>>>> I did somge googleing, it seems they're using a linux emulation layer >>>>> (like wine but pointing the opposite direction) so they can fake argv[] >>>>> in a self-consistent way without too much effort, fork will be trickier. >>>> >>>> Cygwin has had fork() for years. >>> >>> they do a merry dance to get an almost fully working fork. >> >> What exactly is wrong with it? And what sort of "merry dance" that's >> more than is necessary in *nix? > > in *nix fork is a kernel call. it increments the access count, and sets the > copy-on-write bit on all the memory pages, duplicates some file handles and > creates a new process as a clone of the existing one. > > On windows you can't start a process that has a copy of anothers current > environment cheaply. AIUI you either start a thread that's sharing the > same environment or you start a new process in a new environment. > > AIUI cygwin does explicit copying to duplicate everything first. But MS has control of the Windows kernel code, so they can implement copy-on-write semantics without too much difficulty, I'd have thought. No? Cheers Phil Hobbs -- Dr Philip C D Hobbs Principal Consultant ElectroOptical Innovations LLC Optics, Electro-optics, Photonics, Analog Electronics 160 North State Road #203 Briarcliff Manor NY 10510 hobbs at electrooptical dot net http://electrooptical.net