20 September 2023, 19:16 | #21 |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,571
|
I like constexpr. It's nice being able to write something quite expressive, knowing it's going to cost compile time only.
|
20 September 2023, 19:30 | #22 |
Registered User
Join Date: Jun 2020
Location: Druidia
Posts: 389
|
I like it too, but unfortunately that doesn't seem to be what constexpr does every time.
Seems it’s only a suggestion that the compiler might ignore at any point. Last edited by Jobbo; 20 September 2023 at 19:39. Reason: was being a bit too grumpy |
20 September 2023, 19:43 | #23 | |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,571
|
Quote:
https://eab.abime.net/showpost.php?p...&postcount=550 Last edited by Karlos; 20 September 2023 at 19:49. |
|
22 September 2023, 10:52 | #24 |
Registered User
Join Date: Nov 2017
Location: Los Angeles
Posts: 49
|
constexpr is unfortunately flawed, making it not that useful imo (since you can't "trust" it). C++20 adds constinit and consteval which are probably what constexpr should have been, with far stronger compile-time guarantees.
|
22 September 2023, 11:03 | #25 |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,571
|
Trust it how? It's a hint, not a demand.
|
22 September 2023, 11:57 | #26 |
Registered User
Join Date: Nov 2017
Location: Los Angeles
Posts: 49
|
|
22 September 2023, 14:13 | #27 | |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,571
|
Quote:
Personally I tend to use it for simple decision making with "if conxtexpr" based on things like compile time type evaluation, as a way of reducing dependencies on various macros. An example would be the machine register definition in MC64K, which is just a union of supported word sizes (and pointers to them_: https://github.com/IntuitionAmiga/MC...e/register.hpp This allows the register to be accessed as a template, from other templated code at compile, always ensuring the correct element of the union is accessed. This comes in handy for other functions that are templated out, like vector operations https://github.com/IntuitionAmiga/MC.../vec3.hpp#L117 https://github.com/IntuitionAmiga/MC.../vec3.hpp#L154 When these are eventually invoked for a scalar type, everything compile time evaluates to just accessing the union member in the expected way. Last edited by Karlos; 22 September 2023 at 14:19. |
|
22 September 2023, 21:13 | #28 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,698
|
Tell everyone I'm back! - there are 100 ribbons on the old oak tree.
As for the C etc whatever: It really is lovely to hardware code in Assembly. The only reason for not running is because you mistyped an include filename, or misspelled a CPU instruction or symbol name, and the only reason for a program crash is again, only because of a mistake that you made. An oasis in a world gone crazy. Not the accumulated tries and fails with any and all excuses to fail to compile or do so and crash, while all the time the code remains unchanged. Mostly only C/C++ and other "still in beta" languages suffer from this. AMOS, Basics etc were finished and provide a platform to target. |
22 September 2023, 21:58 | #29 |
Registered User
Join Date: Jun 2020
Location: Druidia
Posts: 389
|
Photon, that definitely all true!!!
On Amiga I use C for my own productivity given the limited time I have and the sorts of things I'd like to make. But absolutely it'll bite you hard at times. This is normally because the optimizer is bending the rules in ways that aren't obvious. For example, I had to add memory barriers in one instance because it would reorder things before/after when I enable interrupts. That can be very bad! |
23 September 2023, 09:56 | #30 |
Registered User
Join Date: Apr 2019
Location: UK
Posts: 268
|
My bucket list includes writing an Amiga game in ASM, so I hope this forum is monitored by some old hands for a few more years because I'm bound to get stuck. I made a good start a year or so ago, but got sidetracked writing a mod to p61 converter in (minimal) C++ so it could form part of the toolchain.
|
23 September 2023, 10:57 | #31 | |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,331
|
Quote:
Note, again, that I'm not saying that "C is the perfect language". It certainly is not, it has a couple of odditities you must be aware of, but it is a much better choice for many problems than assembler. But what is the right choice depends of course on the problem you want to solve. There is also AREXX and shell script on the Amiga, and certainly AMOS has also its merits even though I have personally not used it. I personally use whatever is appropriate to solve a problem. That includes also java, C++, python (we do a lot in python recently), bash, it was also C# (even though it has "Micrsoft" written all over it) or whatever else it takes. It is like with human languages. Learn a language, learn a culture. The more you master, the better... |
|
23 September 2023, 11:12 | #32 | |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,571
|
Quote:
|
|
23 September 2023, 11:28 | #33 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,365
|
|
23 September 2023, 12:06 | #34 |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,571
|
|
23 September 2023, 12:28 | #35 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,365
|
I don't think the comparison works. As chisels, saws, planes and sanders are not internally converted by some process to knives.
|
23 September 2023, 12:48 | #36 | |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,571
|
Quote:
Compilers that retain the ability to produce assembly language today primarily do so that it can be inspected, debugged etc. Depending on the language and tooling you are using there may not even be any option to even generate assembly code. If you want to see it, you'd need to disassemble it. In some cases trying to generate the assembly per source is counter productive or outright misleading because you may want to use whole-program/link-time optimisations where all of the notionally separate code from each source unit goes through a final round of optimisation that makes changes that are simply not representable in the assembly output of a single source unit. |
|
23 September 2023, 12:57 | #37 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,365
|
Quote:
And even if you don't admit this evidence, all these tools still need to be converted to some unique tool at one stage or another, and this is machine language. And cpus take 100% of their time executing ML and absolutely nothing else. So no, your tool comparison does not work. |
|
23 September 2023, 13:12 | #38 | |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,571
|
Quote:
Then you have macro expansions and other things that insert code you didn't explicitly write. So while assembler is as close as you'll get to the object code in a human readable format, it's not identical, unless you explicitly disable any optimisation passes, never use any macos, always specify the exact, specific mnemonic for the operation at all times, etc. and don't rely on any "generic" variants like add (always using add, adda, addi, etc). |
|
23 September 2023, 13:31 | #39 | ||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,365
|
Quote:
But you can turn them off if you want to. You can even do that locally. Quote:
As you seem to have ignored my all these tools still need to be converted to some unique tool at one stage or another, and this is machine language... Tools are distinct, with no conversion. Computer languages are all converted to ML in one way or another. This is very different. |
||
23 September 2023, 14:45 | #40 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,331
|
Assembler? Yes, for almost everything it is the wrong tool. Not for everything. Low-level driver code that interfaces hardware is probably the only exception that comes to my mind. P96 drivers are (to some degree) in assembler. For example, higher level code, like GUIs, are not the domain of assembler. It's just more work, and no benefit at all.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Best settings to keep laptop cool and quiet? | MartinW | support.FS-UAE | 11 | 20 July 2019 18:11 |
Quiet in 'ere... | meltdown | Nostalgia & memories | 7 | 04 July 2019 12:51 |
Quiet/Low sound on A600 | 8bitbubsy | support.Hardware | 9 | 24 October 2009 10:00 |
quiet ambient mods | Marcuz | request.Modules | 17 | 07 December 2008 11:38 |
wanting a quiet scsi HDD | rare_j | support.Hardware | 8 | 27 October 2006 13:39 |
|
|