- rules of initialisation in loop (in c and in c+++) - 2 Updates
- Because I'm too lazy to ask my coworkers. - 4 Updates
- How exceptions are implemented? - 1 Update
- C++ move constructors - 8 Updates
- Because I'm too lazy to ask my coworkers. - 1 Update
- neos Universal Compiler and Bytecode JIT -- Coming Soon - 1 Update
fir <profesor.fir@gmail.com>: Mar 07 12:37PM -0800 ould meyba someone remind me what are rules of initialisation of variables whan it is in loop ? i mean for(;;) { Some x = {10, 20, 30}; } will it be initialised each time or only once or will not compile (im not touching compiler now and cant check) (not so long time ago i was stating some thread on close things (named "small c probem" but i tend to forgot such things) and how it is in c++, where such obiect like here Some x would have destructor and construictor... afair c++ enforces that constructor and destrctor are called constantly (which in some way is sorta cretinic i belive), hovever in mentioned thread i see i wrote i made some test with int initialized c++ way int a(10) and it was there working right way (right way imo is doing it only once for block, not for each loop turn some hints? |
Paavo Helde <myfirstname@osa.pri.ee>: Mar 08 12:08AM +0200 On 7.03.2019 22:37, fir wrote: > Some x = {10, 20, 30}; > } > will it be initialised each time or only once or will not compile (im not touching compiler now and cant check) x is defined inside the for loop body so it is initialized and destroyed on each iteration. This is a good thing (tm). If you do not want this you can define x outside the loop, and only assign to it inside the loop. This means two-stage initialization, which is a bit problematic as it makes the things more complicated and error-prone. > (not so long time ago i was stating some thread on close things (named "small c probem" but i tend to forgot such things) > and how it is in c++, where such obiect like here Some x would have destructor and construictor... afair c++ enforces that constructor and destrctor are called constantly (which in some way is sorta cretinic i belive), hovever in mentioned thread i see i wrote i made some test with > int initialized c++ way int a(10) and it was there working right way (right way imo is doing it only once for block, not for each loop turn Strictly pairing a constructor call with a destructor call is called RAII, which is the strongest point of C++, ever. If you want this to happen only once, you define x outside of the loop or as a static (if appropriate). |
"Öö Tiib" <ootiib@hot.ee>: Mar 07 12:56AM -0800 > Are than any decent books meant for inexperienced C++ programs who need to rewrite Java code in C++? it takes about half a year within experienced C++ team for Java programmer to reach level of working alone. > More to the point, I need to rewrite a few thousand lines of Java code for the Android Platform to the C++ equivalent on a Microsoft tablet. The main issue there is that the Android and Windows Phone tools and API-s are quite different and apps mostly consist of configuring and calling those APIs. Just write down every detail that thet the app must do and how. Then write totally new program that just looks same. > I don't know where to look because parts of the code Java code to be directly translated to the C++ equivalent. Perhaps read "A tour of C++". http://www.stroustrup.com/Tour.html. It is less than 200 pages and gives pretty decent overview how to use C++ in general. However the main trouble of yours will be how to make apps in C++ for Windows Phone ... and I don't know any decent materials for that. |
cdalten@gmail.com: Mar 07 04:15AM -0800 On Wednesday, March 6, 2019 at 1:57:47 PM UTC-8, Jorgen Grahn wrote: > > rewrite a few thousand lines of Java code for the Android Platform > > to the C++ equivalent on a Microsoft tablet. > Do you mean C++ books for Java programmers? I think C++ for Java programmers might be what I'm look for since I like to believe that I'm somewhat versed in imperative programming languages.. > > directly translated to the C++ equivalent. > That sentence's beginning is intriguing, but I cannot parse the end. > What did you mean to say? Ideally I'd just like to just change the syntax. Ie, I really don't want to have to rewrite the core algorithms. |
Sam <sam@email-scan.com>: Mar 07 08:24AM -0500 > > Do you mean C++ books for Java programmers? > I think C++ for Java programmers might be what I'm look for since I like to > believe that I'm somewhat versed in imperative programming languages.. You will actually find it easier to learn C++ if you put everything you know about Java out of your mind. Despite C++'s deceptively similar syntax, in many ways C++ is fundamentally different from Java. It is quite common for someone with a Java background to look at some C++ code that looks almost Java and think it does the same thing. It does not, and this only causes constant confusion, and common programming errors that the Java developer will not understand. > Ideally I'd just like to just change the syntax. Ie, I really don't want to > have to rewrite the core algorithms. It is almost a certainty that you will have to. C++ is not Java. Java is managed code. C++ is not. Java will take care of creating, baby-sitting, and destroying all of your objects, after the last reference to each object goes out of scope, and the object becomes subject to garbage collection. There's nothing of that sort in C++. In C++ you have complete responsibility for figuring out when objects are no longer needed, and must be destroyed. Guess wrong one way, and your running program eats all available RAM in a few seconds. Guess wrong the other way, and you get random crashes in some completely different part of the code which has nothing wrong with it, leaving you to wonder WTF is happening. C++ is not Java. To correctly use C++ for anything beyond "Hello world!" you need to fully understand C++'s fundamental scoping rules, and actually understand how objects get created, when they should be created, and when they should be destroyed. As a Java coder, this is something that you have never learned, and you simply don't know because Java always did this for you, by itself. But now you must learn all of this in order to write C++ code that doesn't nuke itself from high orbit, all the time. And you must learn this 100% correctly. No margin for error, whatsoever. Otherwise your code will simply not work. So, no, it is unlikely that you will be able to simply take Java code that does anything more complicated than printing "Hello world!", and just replace it with equivalent C++ syntax. |
Jorgen Grahn <grahn+nntp@snipabacken.se>: Mar 07 09:47PM On Thu, 2019-03-07, Öö Tiib wrote: >> tablet. > The main issue there is that the Android and Windows > Phone tools and API-s are quite different [etc] I was going to flame certain other unhelpful replies, but there's enough negativity in the group. So I'll praise this one instead. Practical, insightful and helpful. (Disclaimer: I don't know anything about these APIs myself.) /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o . |
Thiago Adams <thiago.adams@gmail.com>: Mar 07 10:16AM -0800 On Tuesday, July 17, 2018 at 10:18:06 AM UTC-3, Thiago Adams wrote: > Other way that I guess is simple is to have something > like a linked list of destructors and build this list > after each constructor success. Some news about the subject. https://devblogs.microsoft.com/cppblog/making-cpp-exception-handling-smaller-x64/ |
blt_Gdd@2s6u1wctmk9lsbz.gov.uk: Mar 07 08:52AM On Wed, 06 Mar 2019 14:40:12 +0200 >> reply. >Good for you, as nobody here still has any clue what you actually wanted >to ask. I've stated 3 the question 3 times. I'd suggest you improve your English comprehension before you accuse others of not making sense. >Was it if the compiler logically does s/&&/&/ before starting to compile >C++ code? Oh congratulations, you finally figure out part of it. It only took 4 days. Well done, your mummy must be proud of you. |
blt_mj28k@ov9jxwu4h9kk.gov: Mar 07 08:54AM On Wed, 6 Mar 2019 14:15:57 +0100 >> understanding a simple original question. >You can't cover your misunderstanding by retroactively claiming it was >sarcasm. You failed to understand what I wrote because you were far too Given that anyone who couldn't understand - -1 would have little chance working in programming it would be pretty obvious to anyone who's not aspergers that it was sarcasm. Don't try and cover your inability to understand emotion or read between the lines by self important bluster. |
Paavo Helde <myfirstname@osa.pri.ee>: Mar 07 11:06AM +0200 >> Was it if the compiler logically does s/&&/&/ before starting to compile >> C++ code? > Oh congratulations, you finally figure out part of it. It only took 4 days. I suspected this already before, but I gave you a benefit of doubt. |
David Brown <david.brown@hesbynett.no>: Mar 07 10:50AM +0100 > working in programming it would be pretty obvious to anyone who's not > aspergers that it was sarcasm. Don't try and cover your inability to understand > emotion or read between the lines by self important bluster. Do you really expect anyone to believe you? Sure, you know what subtracting -1 means. But you didn't read that, you were far too interested in making smart-ass comments and insults to take the time to read. |
David Brown <david.brown@hesbynett.no>: Mar 07 10:53AM +0100 > I've stated 3 the question 3 times. I'd suggest you improve your English > comprehension before you accuse others of not making sense. Keep your xenophobia insults to yourself. Paavo (and Öö) write English better than many native speakers - and you make a fair few mistakes yourself. The problem in understanding your question was with the writer, not the readers - the fact that lots of people had trouble figuring out what you meant should have been a clue. |
blt_j9u_@4t0h9a2.gov: Mar 07 10:31AM On Thu, 7 Mar 2019 10:50:53 +0100 >understand >> emotion or read between the lines by self important bluster. >Do you really expect anyone to believe you? Sure, you know what Believe what you like. Your ridiculous attempt to get yourself out of a corner you painted yourself into is quite amusing however :) >Keep your xenophobia insults to yourself. We'll note down xenophobia as another subject you don't have a clue about shall we. |
Sam <sam@email-scan.com>: Mar 07 07:07AM -0500 > Believe what you like. Your ridiculous attempt to get yourself out of a > corner > you painted yourself into is quite amusing however :) I just read that there's a Monty Python remake that's in the works. You should really audition for the role of the Black Knight. You'd be a natural. > >Keep your xenophobia insults to yourself. > We'll note down xenophobia as another subject you don't have a clue about > shall we. Indeed. You're the undisputed xenophobic champion of 2019. Nobody knows more about xenophobia than you. |
James Kuyper <jameskuyper@alumni.caltech.edu>: Mar 07 07:55AM -0500 > working in programming it would be pretty obvious to anyone who's not > aspergers that it was sarcasm. Don't try and cover your inability to understand > emotion or read between the lines by self important bluster. The fundamental problem with that explanation is that your comment makes no sense as sarcasm - whereas it's entirely plausible that, in your haste to insult anyone and everyone who disagrees with you, you missed the minus sign. You can claim otherwise. You might even be telling the truth - but if it is true, you're out of luck, because this particular truth is too implausible in this context to be believed. |
ram@zedat.fu-berlin.de (Stefan Ram): Mar 07 12:59AM >Are than any decent books meant for inexperienced C++ >program[mer]s who need to rewrite Java code in C++? The book has just one page: "You're not the right one for this job, because someone who already knows Java and C++ can do it much better than someone who just starts to learn C++ for this job." If someone absolutely must do this and already knows Java and general programming, he can read: |The C++ programming language |Bjarne Stroustrup |4th edition or newer and/or |C++ primer |Barbara Moo et al. |5th ed or newer . |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Mar 07 12:18AM From https://neos.dev ... neos Universal Compiler and Bytecode JIT -- Coming Soon Introduction ------------ neos is a cross-platform (C++) universal compiler that can theoretically compile any scripting/programming language. The compiler targets custom bytecode used by a custom VM with JIT. neos will be used as the scripting engine in the neoGFX project. The plan is for version 1.0 of neos to ship with implementations of the following scripting/programming languages: * Ada * JavaScript * Lua * Python * Forth * C * Rust * Haskell neos is open source and the source is available from: https://github.com/i42output/neos. Features -------- * Language agnostic: a language schema file describes the syntax and semantics of the scripting/programming language to use (theoretically allowing any language to be used). * Easy to write RJSON (Relaxed JSON) language schema file format. * Extensible generic (cross-language) semantic concepts (extendable by providing semantic concept plugins). * The ability to mix source code from different programming languages within the same source file. * Invent your own scripting language to use with neos by writing a new language schema! Mixing Programming Languages ---------------------------- With neos it is possible to mix code from different programming languages in the same source file. These source files have the .mix file extension. Here is an example .mix file: # The following line defines the language selection character (.mix files are UTF-8 encoded)... %%%⚛% ⚛⚛c⚛ /* make c the default language and select it */ #include <stdio.h> ⚛c++⚛ /* select the c++ language */ #include <iostream> ⚛ada⚛ with Ada.Text_IO; use Ada.Text_IO; ⚛⚛ /* select the default language (c in this example) */ void hello_from_c() { printf("Hello, world (from C)!\n"); } ⚛ada⚛ procedure Hello is begin Put_Line("Hello, world (from Ada)!"); end Hello; ⚛⚛ int main() { hello_from_c(); ⚛c++⚛ std::cout << "Hello, world (from C++)!" << std::endl; ⚛ada⚛ Hello(); ⚛⚛ printf("Hello again from C!\n"); } /Flibble -- "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
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