Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: Safety of casting from 'long' to 'int' Date: Sun, 10 May 2026 13:21:30 -0700 Organization: A noiseless patient Spider Lines: 45 Message-ID: <861pfjrp6d.fsf@linuxsc.com> References: <10su8cn$am9i$1@dont-email.me> <10tfclh$7vb$1@reader1.panix.com> <10tflij$19d6u$1@dont-email.me> <10tg55j$kvp$1@reader1.panix.com> <10tgfs8$1i2g4$1@dont-email.me> <10tlj1h$129ms$1@paganini.bofh.team> <10tls2u$39j7a$1@dont-email.me> <10tmhvb$19hk3$1@paganini.bofh.team> <10tn877$3kg8u$1@dont-email.me> <10todi7$3vl63$2@kst.eternal-september.org> <10togv8$b63$2@dont-email.me> <10tojpf$14cu$1@kst.eternal-september.org> <20260510034637.0000286b@yahoo.com> <10tol0p$14cu$2@kst.eternal-september.org> <1L1MR.157322$xksf.154929@fx43.iad> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Sun, 10 May 2026 20:21:31 +0000 (UTC) Injection-Info: dont-email.me; logging-data="666561"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19XVh5NhlByviiuIN2PkN3x9E4DyJlH1eo="; posting-host="6036d710c83bf18720fd516086d32b65" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:WU0gOVvJ9YIzOgv6kLwn6n4LKt0= sha1:oXmNTejvIU2ix9cnmTRcYopat80= sha256:4usXDRWASM9ebo5R2m8lYDm/LaytcPA0fTdO/Zbb2bA= sha1:1P8cBPwK2PfFTXy2xYCbq9kp4mw= Xref: csiph.com comp.lang.c:398670 scott@slp53.sl.home (Scott Lurndal) writes: > Keith Thompson writes: > >> Michael S writes: >> >>> On Sat, 09 May 2026 17:33:51 -0700 >>> Keith Thompson wrote: >>> >>>> Right, you don't know what to call it. I think the term you're >>>> probably looking for is "translation unit". >>>> >>>> If you have something to say about splitting a C translation unit >>>> (something I don't think I've ever had a need to do), >>> >>> That surprises me greatly. >>> In my practice refactoring that includes splitting translation units >>> is rather common. >>> >>> Or, may be, I misunderstood your above sentence and you meant that >>> you never had a need *to say* something about splitting etc...? >>> >>>> perhaps because >>>> you've had difficulties doing so yourself, feel free to elaborate. >> >> I didn't give it a lot of thought, but I haven't done a lot of >> refactoring of C projects. My experience is of course not universal, >> and may not be representative. > > I don't recall refactoring existing code, primarily because the > original programmers used multiple translation units logically > dividing the code into functionly related segments, where necessary, > from the start. There are various forces that influence the partitioning of programs into multiple .c files. These forces can change over the life of a project, as the code evolves. An obvious one is that as code is added, a single .c file can grow to the point of being overly large, and dividing it into two or three seems like a good idea. Having said that, I don't remember it ever being a big deal. If some source file needs to be subdivided, you simply subdivide it and move on. The effort needed to do re-partitioning is a small fraction of the overall code development effort. Not worth worrying about.