| Andrey Tarasevich <andreytarasevich@hotmail.com>: Sep 26 01:19PM -0700 On 9/26/2022 3:36 AM, Paavo Helde wrote: > statics. But what about static libraries? Are the global statics in > static libraries initialized in the order I list the libraries on the > linker command-line? Huh? What is "initialization of a static library"? There is no such concept. There's no need for such a concept. A static library is a just an archive of object files. All you do with a static library is pull one or more object files from that archive. A static library has no other presence in the translation process. It does not affect anything. Object files from static library map to the language-level concept of *translation units* is exactly the same way as ordinary standalone ("library-less") object files do. In other words, the matters of order-of-initialization work the same way for standalone translation units and for translation units packed into a library. They all live in one global flat universe. Placing something into a static library has absolutely no effect on the matters of global order-of-initialization. In short, when you pack a translation unit (i.e. an object file) into a static library, it changes absolutely nothing. Static libraries do not have initialization. -- Best regards, Andrey |
| scott@slp53.sl.home (Scott Lurndal): Sep 26 09:54PM >> linker command-line? >Huh? What is "initialization of a static library"? There is no such >concept. There's no need for such a concept. ... >In short, when you pack a translation unit (i.e. an object file) into a >static library, it changes absolutely nothing. Static libraries do not >have initialization. In the context of executing constructors for statically defined objects, the order is indeterminate, whether the application is fully linked (i.e. static libraries) or dynamically linked. |
| Gawr Gura <gawrgura@mail.hololive.com>: Sep 26 07:40AM -0700 On 9/26/22 01:33, Juha Nieminen wrote: > types, like ones containing a couple of ints, and which would ostensibly > be instantiated millions of times (such as structs representing a point > or a pixel). Burn that kind of suggestion with fire!) The example I've given is deliberately simplistic for the sake of illustrating the technique. A competent programmer has to weigh their needs against the tools available. If the dynamic allocations implied here are too much overhead then, as has already been explained, there are ways to achieve the same effect without dynamic allocations. If the function calls are too much overhead then you can do away with this technique entirely and go the route of simply not mishandling data. I don't think, "basically never do that," is good advice. Don't do it when it's inappropriate. Always engage in critical thinking about your software. Use techniques that are appropriate for your needs. Almost every C library I've encountered uses opaque types somewhere (FILE being one obvious example in the standard itself). |
| Muttley@dastardlyhq.com: Sep 26 03:19PM On Mon, 26 Sep 2022 07:27:05 +0300 >> But C doesn't have references, so you can't do that. >> In C++, it would be private, so you couldh't do it. >oh but could use pointer then. so if it was int* l Its a bit hard to accidentaly write &(str->length) rather than str->length |
| JiiPee <kerrttuPoistaTama11@gmail.com>: Sep 26 09:53PM +0300 > Its a bit hard to accidentaly write &(str->length) rather than str->length no, I mean if the function takes a pointer (not a variable), and we are meant to pass a pointer to the lenght. But we dont know its also changing it. Lets *assume* that a calculation is done like this: float calculate(int round, int* lenght); And then you call it with your lenght: calculate(1110, &(str->length)); thinking that its only reading the lenght. but its changing it also. |
| rbowman <bowman@montana.com>: Sep 26 09:04AM -0600 On 9/26/22 05:55, David Brown wrote: > initialisers in C++, which suggests that they were not viewed as the > most important feature (though there has certainly been plenty of call > for them in C++). I'd go with the ability to place declarations close to the code using them also. Throwing in curly braces worked but it wasn't too elegant. |
| Bart <bc@freeuk.com>: Sep 26 04:05PM +0100 On 26/09/2022 15:31, Juha Nieminen wrote: > before, after, or in-between the ones being initialized. It really makes > a lot easier. (It also allows for those structs to be changed by eg. > adding new member variables without breaking tons of existing code.) I don't like designated initialisers. First because my private C compiler doesn't support them, so I have to switch to another when some code uses them, or edit it to remove the dependency. But also, they tend to be used gratuitously; I've actually seen examples like this: typedef struct {int x, y;} Point; Point p = {100, 200}; // without designated initialisers Point q = {110, 220}; Point r = {.x = 100, .y = 200}; Point s = {.y = 220, .x = 110}; The designated ones introduce too much clutter for a simple struct like this, but also people feel free mix up the order, just because they can. So you can't as easily see the patterns like those in the first example, or they can be misleading unless you keep an eye on those names. Another problem is when you decide to change the member names, especially when the names weren't particularly important. Just changing the order can mean data within the struct will get mixed up. |
| Muttley@dastardlyhq.com: Sep 26 03:24PM On Mon, 26 Sep 2022 08:42:43 +0200 >> >Minecraft is probably the Java application with most users. But Java >has been hugely popular for in-house and dedicated programs for Java looks great at first - no pointer issues, fully (almost) OO and garbage collected. Then a team writes a huge application in it which sucks up 100s of megs of memory just to boot, hangs at inappropriate moments while it GCs and generally runs multiple times slower than something similar written in C++. Then they find the write once run anywhere mantra only works if you don't do anything OS specific which for any given business app is unlikely and the 101 libraries to do the same thing becomes unmanagable. >businesses, so there is a vast investment in Java code that most people >never see. It may go out of fashion, but like Cobol, it will never die. True, but its doubtful much new greenfield code relatively speaking will be written in it in the future. |
| "daniel...@gmail.com" <danielaparker@gmail.com>: Sep 26 09:00AM -0700 > True, but its doubtful much new greenfield code relatively speaking will be > written in [Java] in the future. I think you've been misinformed :-) Sometime in the 1990's, Java largely replaced C++ in middleware tooling for business-to-business messaging, data transformation, application servers for enterprises, and IT infrastructure software generally as vendors including IBM, Oracle, and Tibco all moved to Java. That's a huge code base. There's some competition in this space from .NET ASP, which is now cross platform across Linux, macOS, and Windows, but most of the major vendors in this space are firmly in the Java camp. There's also a massive amount of Java open source code in this space, including a JVM, particularly with the Apache Software Foundation. Daniel |
| Muttley@dastardlyhq.com: Sep 26 04:11PM On Mon, 26 Sep 2022 09:00:34 -0700 (PDT) >Sometime in the 1990's, Java largely replaced C++ in middleware tooling for >business-to-business messaging, data transformation, application servers for >enterprises, Its not the 1990s anymore. |
| "daniel...@gmail.com" <danielaparker@gmail.com>: Sep 26 09:22AM -0700 > >business-to-business messaging, data transformation, application servers for > >enterprises, > Its not the 1990s anymore. Indeed :-) But the domination of Java in middleware tooling for business-to-business messaging, data transformation, application servers for enterprises, and IT infrastructure software generally remains, and major vendors like IBM, Oracle and Tibco aren't moving anywhere, from the looks of it. I realize this isn't your space. Daniel |
| Keith Thompson <Keith.S.Thompson+u@gmail.com>: Sep 26 10:44AM -0700 >> If that are your arguments against a lanuage - don't program at all. > I thought you weren't reading any of my "nonsense". So why are you? > Just go away, asshole. Juha, if you do not stop feeding the trolls, I will treat you as a troll yourself and add you to my killfile. You do not have to respond to everything. I have several users filtered out by the equivalent of a killfile. You are bypassing my killfile by posting responses. Please stop. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips void Void(void) { Void(); } /* The recursive call of the void */ |
| You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment