Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  nodelist  faq  

Please go away.


programming / comp.lang.c / latest

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 6 Hours 36 Minutes ago by: Kenny McCormack

As I'm sure you figured out, you have to change "blob" to "raw" in the above URL to make it fetchable with, e.g., "wget" (or "curl", etc) ....

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 7 Hours 13 Minutes ago by: Keith Thompson

[...] [...] My mistake, I assumed I could download it directly from that URL and got an HTML file (and didn't check its contents). The executable is 1046016 bytes. It would't compile my test program because it apparently treats "long do

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 7 Hours 28 Minutes ago by: Bart

I know what I mean by it. Which is the ability to relocate a contiguous block of code at any address, and internal references /within/ the code still work. But not to move parts of it separately. (I think this was discussed on comp.la

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 7 Hours 58 Minutes ago by: Bart

OK, if the size of bcc.exe is 1,046,016 then it's a puzzle. If a bit smaller, it might be corrupted. In either case, never mind. (I no longer have up-to-date generated-C versions as an alternative.) Dump of bcc.exe; Size = 1046016 byt

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 8 Hours 22 Minutes ago by: Bart

Yeah. On the blue W10 laptop, it didn't work. On the purple one, it did. msvcrt.dll on the blue one is dated 2016; on the purple, 2019. (I didn't have much luck copying the 'good' msvcrt.dll to my W7 PC, but it needs a better attempt

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 8 Hours 23 Minutes ago by: antis...@math.uni.wr

Possibly. As I wrote, there are traps and even if you use proper compiler and linker options the result may be disappointing. Do you know what position-independent code means? And what static linking means? With static linking relati

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 8 Hours 24 Minutes ago by: Keith Thompson

[correction: tcc-generated] This version of C:\cygwin64\home\kst\bcc\bcc.exe is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher. A p

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 8 Hours 45 Minutes ago by: Bart

You might try also this compiler: https://github.com/sal55/langs/blob/master/bcc.exe Run as: bcc hello.c This relies 100% on Windows' msvcrt.dll to do printf.

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 8 Hours 49 Minutes ago by: Keith Thompson

Yes, thank you, that was a typo. Results on your Windows 10 system could be interesting. OK, so it works correctly on my system but not on yours. I'll note that I've seen multiple versions of msvcrt.dll in different directories on my

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 9 Hours ago by: Bart

You mean tcc rather than lcc? I downloaded this exact version with these results: -------------------------------------- C:\tcc>dir .... 01/08/2021 00:08 <DIR> . 01/08/2021 00:08 <DIR> .. 01/08/2021 00:04 <

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 9 Hours 20 Minutes ago by: Richard Damon

Yes, to generate the information to allow selective linking adds a lot of meta-data to the object files. That is one reason it normally isn't the default for the compiler, as it assumes that most files being compiled don't have a lot of

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 9 Hours 25 Minutes ago by: Keith Thompson

[big snip] I've just done a similar experiment with tcc, installed on Windows 10 from http://download.savannah.gnu.org/releases/tinycc/tcc-0.9.27-win64-bin.zip There's a win32 installer as well. I didn't try it. Using the same pro

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 9 Hours 30 Minutes ago by: Manfred

Yes, as I wrote earlier, this feature requires the cooperation of the compiler with the linker, if the compiler was not instructed to generate the library code accordingly, you are stuck with object module granularity (as per your earl

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 9 Hours 44 Minutes ago by: Keith Thompson

[big snip] I've just installed TDM-GCC on my Windows 10 laptop. There are two current installers, one based on MinGW.org (32 bits) and one based on MinGW-w64 (64 bits). I tried both. Quick summary: printf's "%zu" works correctly with b

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 10 Hours 4 Minutes ago by: Bart

To clarify, these options need to be applied to the library in question. If it's a third party library, then presumably you have to depend on the people creating the .a or .lib file to use suitable options. (When I tried it on a small

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 10 Hours 39 Minutes ago by: Bart

Because it's plainly crazy. So presumably that wasn't done with that libraylib_static.a library that I used? See, you don't have control over the libraries that other people distribute. Hmm, yes it does, at least on x64 architectu

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 10 Hours 53 Minutes ago by: Lew Pitcher

[snip] In "A Tour through the UNIX C Compiler" (D.M. Ritchie, Bell Laboratories, reprinted in "Unix Programmer's Manual Volume 2 (c) 1979, 1983), Dennis Ritchie makes it clear that said compiler's input was the output of a separate C-lan

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 11 Hours 41 Minutes ago by: antis...@math.uni.wr

It clearly shows that printf is independent and that you can easily replace it by your own. It shows advantage of having a linker: you have control of what gets into your executable. It shows that there is no excuse of sort "Windows doe

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 12 Hours 16 Minutes ago by: Keith Thompson

No, I'm not. "cc" is as driver program that might invoke several different programs, including a preprocessor, a compiler, an assembler, and a linker. It was perfectly reasonable for K&R not to get into those details in the "Getting Sta

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 12 Hours 17 Minutes ago by: antis...@math.uni.wr

You are exagerating: - Cygwin binaries are Windows binares (they will not run natively on other systems) - Cygwin gcc can create binaries which are independent of Cygwin libraries. That is how MinGW was born: they used Cygwin gcc a

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 12 Hours 42 Minutes ago by: Manfred

It turns out it's not that trivial, after my earlier reply I decided to double check it, and in fact I had to ask google about it: https://stackoverflow.com/questions/6687630/how-to-remove-unused-c-c-symbols-with-gcc-and-ld In short: co

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 12 Hours 56 Minutes ago by: antis...@math.uni.wr

David presented too rosy picture (more below). But your tests ignore how things are supposed to work, so only say something about you, not about size of statically linked libraries. That is traditional behaviour of linkers, no surprize

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 13 Hours 56 Minutes ago by: Bart

I'm using tdm-gcc on Windows, which uses .a files as they are on Linux, created with the 'ar' utility. My tests with a 4MB library, libraylib_static.a, showed a program with just one reference to one symbol, resulted in executables

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 14 Hours 41 Minutes ago by: Manfred

No, it is right. My brief experiments seem to show: That's the difference. You should test it with a final executable (and a decent compiler). (btw I assume you didn't mean .a as a linux library, so what did you mean with .a ?) Tha

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 18 Hours 18 Minutes ago by: Bart

I don't think this is right. My brief experiments seem to show: * If you link in biglib.o, it will include everything from biglib, whether or not used from outside * If you create biglib.a, and link in biglib.a, it will still include

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 20 Hours 32 Minutes ago by: David Brown

When you use statically linked libraries, you only link in the functions you actually /use/. So it doesn't matter if the static library supports a hundred thousand WinAPI functions and weighs in at 100 MB - if you use a hundred function

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 21 Hours 35 Minutes ago by: Bart

And? If I look at K&R2 page 6, they show the hello-world example that uses printf(), and suggest it is built using: cc hello.c This seems to magically work, in exactly the same way that: gcc hello.c does on Windows. They even

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 21 Hours 47 Minutes ago by: Bart

These are the parameters passed to ld.exe when I run 'gcc hello.c': 1: c:/tdm/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe 2: -plugin 3: c:/tdm/bin/../libexec/gcc/x86_64-w64-mingw32/9.2.0/liblto_plug

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 3 Hours ago by: Keith Thompson

[...] And to be clear (for Bart's possible benefit), msvcrt.dll is an outdated C library implementation that provides things like printf, while libgcc is a more limited library that provides features that are more tightly tied to the comp

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 3 Hours ago by: Keith Thompson

I believe there is a point. You very commonly gloss over the distinction between an *implementation* and a *compiler*. An implementation consists of several components; the compiler is just one of them. In this thread, you've talked ab

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 6 Hours ago by: Kaz Kylheku

Umm, no. For instance, GCC is used for compiling various embedded code bases that do not have a printf. (One example being the Linux kernel, which has printk.) GCC has diagnostic features to help find problems statically in calls to prin

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 6 Hours ago by: Bart

A program compiled with or without -lucrt will import msvcrt.dll (from looking inside the exe file). But it only imports vfprintf() that is relevant. (gcc's stdio.h defines printf in terms of __mingw_vfprintf, so will not import print

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 7 Hours ago by: Bart

Sorry, I don't know what your example is supposed to show. As it is, your printf is close enough to the real printf for gcc not to complain. Although when I compile ts2a.c (c.c below) with gcc -Wall, it warns about the unknown "z" in t

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 7 Hours ago by: Bart

I first started using msvcrt.dll or equivalent in mid-90s. I didn't use it from C. To me it was just another library that came with Windows, with a smaller and much simpler API. It was also documented as part of the SDK IIRC. I was h

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 8 Hours ago by: Keith Thompson

OK, that demonstrates that TDM-GCC by default does not support "%zu". It doesn't directly demonstrate that it uses MSVCRT.DLL, but that's probably the most likely explanation. Did you want to reply to anything else I wrote? Should I ass

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 8 Hours ago by: antis...@math.uni.wr

You should know how things work (and 'long long' is sign that you prefer to complain instead of taking advantage of capabilites of gcc). As a little ilustration that printf is independent from gcc you can try the following (on Linux, see

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 8 Hours ago by: Keith Thompson

Who says it has to? I use a version of gcc that runs under Cygwin because I find it convenient. I mentioned its behavior because that was the information I had. When did I tell you you're doing something wrong? You're apparently usin

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 9 Hours ago by: Bart

#include <stdio.h> int main(void) { printf("Hello, World! %zu\n",sizeof(void*)); } gcc (tdm64-1) 9.2.0 Hello, World! zu Hello, World! 8 Hello, World! zu

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 9 Hours ago by: Bart

But why does it have to run under Cygwin? It's clearly trying to recreate some aspects of Linux under Windows. Therefore you can't compare that version of gcc with mine. For a fair comparison, install what I have, and run it as I do. T

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 9 Hours ago by: Keith Thompson

[...] https://jmeubank.github.io/tdm-gcc/about/ : TDM-GCC is a compiler suite for Windows. It combines the most recent stable release of the GCC compiler, a few patches for Windows-friendliness, and the free and open-source

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 9 Hours ago by: Keith Thompson

The warning message and the option name contain different information. And both omit some relevant information so they don't turn into novels. Strictly speaking, the declaration of printf is in the <stdio.h> header, which is not provide

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 10 Hours ago by: Keith Thompson

Nobody suggested buying a new PC. If your current PC isn't powerful enough to support WSL (the only reason I can think of for you to bring it up), then you can either get a new PC or not use WSL. I have no opinion on which you should do

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 10 Hours ago by: Keith Thompson

I don't recall saying that. I said that gcc under Cygwin works as a data point.

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 10 Hours ago by: Keith Thompson

Whose responsibility do you think it is? You installed gcc on your Windows system *somehow*. The gcc project itself does not provide installers for Windows. You installed something from some third party, and that installer is responsib

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 10 Hours ago by: Chris M. Thomasson

Indeed!

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 10 Hours ago by: David Brown

It does say "builtin /declaration/ mismatch" - the "printf" function is not a builtin in gcc, but the declaration is. (As you mentioned, it can have that since the C standard specifies the declaration.) Like many standard C functions, g

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 10 Hours ago by: Keith Thompson

Right, gcc and glibc are separate projects, both under the GNU umbrella. I'm unsure of the relationship between newlib and GNU (a quick look at its README and MAINTAINERS files was a bit confusing), but that doesn't really matter for most

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 10 Hours ago by: Chris M. Thomasson

Iirc, they have a lot of legacy code from Dinkumwarein in there: https://www.dinkumware.com/

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 10 Hours ago by: David Brown

I /do/ understand the point of DLL's. The possibility of sharing space is just one aspect - and it is totally underused on Windows, since pretty much every program installs its own copies of the DLL's it needs (with the exception of the

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 11 Hours ago by: Bart

I have half a mind to change the name of my own product to 'gcc'. Then when I talk about how it works, I'd be 100% correct. And when you guys tell me what I say doesn't apply to 'the' gcc, whatever that is, then you'd now be 100% right

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 11 Hours ago by: Chris M. Thomasson

[...] [...] Windows on a Dec Alpha was fun!

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 11 Hours ago by: Bart

This is actually pretty crazy, suggesting buying a new PC with Windows 10, switching OS pretty much, to solve an utterly insignificant non-problem. Keith posted some code with "zu", that I never use myself, and would never use anyway,

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 12 Hours ago by: Scott Lurndal

So use WSL instead of cygwin. You can download it from the windows store, in multiple flavors. Fully supported by Microsoft.

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 12 Hours ago by: Scott Lurndal

As David pointed out, your 'gcc' isn't 'the gcc'. It is some anonymous person building the open source gcc compiler on windows.

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 12 Hours ago by: Bart

If you're using gcc via Cygwin, then all bets are off. It's not using gcc as a native Windows application, actually I don't even know if you still end up with EXE files rather than ELF, and I don't know what libraries will be used. Cy

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 12 Hours ago by: Bart

Well, /I/ didn't tell gcc which runtime to choose. Or is that now my responsibility? I now know that mine will default to Windows' msvcrt.dll unless I specifically tell it to use libucrt.a. Why the default isn't the other way around i

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 13 Hours ago by: Bart

Hmm, the hello.exe executable generated by gcc (after you specify -ohello.exe!) is about 330KB. And this still imports msvcrt.dll. So small executables aren't the reason gcc does it. (tcc produces a 2KB executable.) You also don't see

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 13 Hours ago by: Manfred

Still I believe that none of them is officially supported by the gcc team.

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 13 Hours ago by: Manfred

C APIs (meaning APIs written in C) are excellent for cross-language implementations, in fact the Windows API /is/ a C api because that's the best choice to make it usable by the plethora of languages that Microsoft markets. If what yo

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 13 Hours ago by: Keith Thompson

Cygwin gcc uses newlib, not glibc.

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 13 Hours ago by: Keith Thompson

[...] [...] Cygwin is one way to use gcc under Windows, but it's not the only one. There are other implementations on Windows that include gcc but are not connected to Cygwin. See for example mingw-w64 (which seems to have some relations

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 14 Hours ago by: Keith Thompson

[...] No, they are not. They are components that can be combined with other components to create a C implementation. Getting that right is the responsibility of whoever puts together the implementation. You've written compilers, so you

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 14 Hours ago by: Keith Thompson

[...] No, he's right. gcc's warning message for that is: warning: conflicting types for built-in function ‘printf’; expected ‘int(const char *, ...)’ [-Wbuiltin-declaration-mismatch] The use of the term "built-in" is s

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 14 Hours ago by: David Brown

That matches precisely with what Kaz wrote. Using MSVCRT.DLL as your "system C library" is a lazy, undocumented way to make your C programs work, and being able to boast (pointlessly) about generating small executables. The DLL is slow,

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 14 Hours ago by: Keith Thompson

Apparently MSVCRT.DLL is an old C runtime library that's still shipped with Windows for backward compatibility. It (probably) was the recommended C library implementation for use by Windows applications as of about 20 years ago. https:/

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 14 Hours ago by: Scott Lurndal

RTFM. And, much as I dislike the GNU info utility UI, the data is well organized and fairly complete. I believe he mentioned using cygwin gcc, which comes with glibc.

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 14 Hours ago by: Bart

Are you serious? Just gcc.info is 1000 pages of options. Someone who has been using: tcc prog.c effectively, and now wants to try gcc, expects to type the equivalent: gcc prog.c except for options like -O3 to get faster code.

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 16 Hours ago by: james...@alumni.calt

No, I don't, because I read the documentation. I expect gcc to use whichever library it's connected to, whether or not that library constitutes a conforming implementation of the C standard library. In order to get a fully conforming impl

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 16 Hours ago by: Scott Lurndal

Vi has supported ctags for decades. vim supports cscope integration.

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 16 Hours ago by: Ben Bacarisse

Oh, I thought vi could do this "out of the box". But I'm not a vi person so I may have got the wrong end of the stick. That's fine. It the "neither of which [vi or emacs] have that kind of intelligence" I was commenting on.

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 16 Hours ago by: Bart

Yet gcc on Windows (or my TDM version of it) does the same. As does Tiny C. So would any application built with those compilers. Including tcc.exe itself. And gcc.exe itself. (I don't have time to look at various other applications.)

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 16 Hours ago by: Lowell Gilbert

Digressing, I know, but that's flatly untrue. Both programs have had basic functionality for that, using external databases, for thirty or forty years.

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 16 Hours ago by: Manfred

This is a Windows problem, not gcc. As far as I can tell printf comes with the famous msvcrt.dll, which comes with Windows, BUT also comes with msvcrXXX.dll as an official redistributable of Visual Studio, that Microsoft allows to dist

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 16 Hours ago by: John Bode

Ah. I'm a vi dinosaur. I've tried to learn emacs, but I just don't have the ability to keep all the key combinations straight. If there's a way to do it in vi - well, I probably won't use it enough for it to stick in working memory and

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 17 Hours ago by: Bart

OK. But gcc and tcc are products that you expect to make the necessary arrangements for ensuring they your program can call a C standard function called "printf". Which they do, because it generally works. But whatever it is they end

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 17 Hours ago by: Kaz Kylheku

Windows 10 does not come with a C library. Windows 10 comes with an undocumented internal component called MSVCRT.DLL (or something similar) which is in the system folder. This is used by some utilities that come with Windows. If you c

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 17 Hours ago by: Kaz Kylheku

The above has no meaning. "gcc" is not the name of any software that provides a printf function.

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 17 Hours ago by: Kaz Kylheku

There is no "its C implementation" in regard to Windows. C programs for Windows carry their own C run-times. (Some misguided developers think that an undocumented component called MSVCRT.DLL in the system folder provides parts of the Lib

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 17 Hours ago by: Kaz Kylheku

That has no meaning. "Windows" is not a C implementation. %zu works on Windows if you find a C implementation for Windows with a run-time library whose printf supports it. I see that Microsoft is documenting "z". Find the MSDN documenta

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 17 Hours ago by: Ben Bacarisse

I use etags+emacs. Works fine. There might even be a more modern and automatic way to do this, but I tend to stick with what I've used before.

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 1 Day 18 Hours ago by: John Bode

Being common doesn't make it right. I work on remote Linux instances through terminal sessions - my choices of editor are either vi or emacs, neither of which have that kind of intelligence. And I've been dealing with code where typede

Re: preprocessor shenanigans: labels in pseudo-assembly code

comp.lang.c

Posted: 2 Days 1 Hour ago by: luser droog

Back to the first idea. I added labels to for each phrase. Then I changed it to run through the argument list twice. Creating labels during the first pass, and just counting the length of each byte sequence. Then it runs through the li

Re: preprocessor shenanigans: labels in pseudo-assembly code

comp.lang.c

Posted: 2 Days 5 Hours ago by: luser droog

I tried that and it works but doesn't help. I coded up the idea, using ppnarg, pasting and dispatching, wrapping the phrases so the _ pointer (ie. "dot" or "dollar", the current offset) is correctly updated with the size of the previous p

Re: What does (real) number mean?

comp.lang.c

Posted: 2 Days 10 Hours ago by: James Kuyper

.... In more detail, here's what the C standard has to say about it: "The accuracy of the floating-point operations (+, -, *, /) and of the library functions in <math.h> and <complex.h> that return floating-point results is implementati

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 2 Days 12 Hours ago by: Keith Thompson

I did, and it is. I don't know enough about it to answer that. I use Visual Studio for work and Cygwin for personal use. I don't have a gcc-based implementation outside Cygwin. Microsoft's online documentation says "%zu" works. I kn

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 2 Days 13 Hours ago by: Bart

You said 'Windows 7 is obsolete'. Anyway, how can the C library be obsolete if it comes /with/ Windows 10? Even if I could, installing a different library wouldn't be much help, since then I'd have programs that worked fine on my Windo

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 2 Days 13 Hours ago by: Keith Thompson

No, it looks like you're using an obsolete C library implementation on Windows 10. I'm able to compile and run your program on Windows 10, and it prints 8 or 4 depending on which implementation I use. You could probably get some help wi

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 2 Days 14 Hours ago by: Bart

Looks like Windows 10 is obsolete too: c:\c>ver Microsoft Windows [Version 10.0.14393] c:\c>type c.c #include <stdio.h> int main(void) { printf("%zu\n", sizeof(void*)); } c:\c>gcc c.c c:\c>a

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 2 Days 14 Hours ago by: Keith Thompson

[...] gcc doesn't implement printf. The C library does. Bart is using an obsolete version of Microsoft's C library.

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 2 Days 14 Hours ago by: Keith Thompson

The problem is with the old C library. The version of gcc is irrelevant. Windows 7 is obsolete. If you're stuck using it for some reason, that's a valid reason to avoid "%zu". "it doesn't work on Windows" is not.

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 2 Days 15 Hours ago by: Scott Lurndal

It has _always_ worked properly with GCC. You're clearly either doing something incorrect if your assertion is accurate. $ cc -o /tmp/b /tmp/b.c $ /tmp/b 8 $ cat /tmp/b.c #include <stdio.h> int main(void) {printf("%zu\n",sizeof(void*));

Re: What does (real) number mean?

comp.lang.c

Posted: 2 Days 15 Hours ago by: Ben Bacarisse

It's more accurate to say that floating-point numbers are exact. Yes. The results of operations (and that includes input and the conversion of source-code literals) may not be representable. Most quality implementations will give ver

Re: What does (real) number mean?

comp.lang.c

Posted: 2 Days 15 Hours ago by: wij

Precisely, FP is an encoding of number in (binary) scientific notation. Floating-point number almost represents an approximate number. The error accumulates. I understand the changes would not happen in decades. Like the global warming

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 2 Days 16 Hours ago by: Bart

It's Windows 7. gcc is version 9.2.0. This program: #include <stdio.h> int main(void) {printf("%zu\n",sizeof(void*));} displays 'zu' with gcc, tcc and bcc (my product that uses msvcrt.dll). It shows the correct value with lccwin

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 2 Days 16 Hours ago by: Bart

You have a small point, but mainly you're just making excuses for some terrible header code that should long have been cleaned up. The _mingw_off_t.h file I posted that makes such a meal of defining off_t, is specifically for Windows

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 2 Days 17 Hours ago by: Keith Thompson

[...] Yes, it does. I don't know why it wouldn't work for you. Are you using some obsolete version of Windows or of its C implementation? [...]

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 2 Days 18 Hours ago by: Scott Lurndal

No, you're missing the point. 99.9999% of people writing code in the C language don't need to know what the underlying type is. Noting that it (off_t for example) is a signed integer is all they need to know. No, it's not. C runs on

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 2 Days 18 Hours ago by: Bart

People seem to be missing the point. You shouldn't NEED to write scripts, install a C compiler, write test programs just to find out what a type is! They shouldn't work as hard as they do to hide these types. For goodness sake, an offs

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 2 Days 19 Hours ago by: John Dill

This is kind of what build systems are for, even though it doesn't suit Bart's tastes. To find the size of an opaque type, you'd leverage something similar to ac_check_sizeof from autoconf that basically generates a C program, runs the p

Re: What does (real) number mean?

comp.lang.c

Posted: 2 Days 22 Hours ago by: Malcolm McLean

Floating point number are a sufficient approximation to real numbers for most purposes. The exception is when doing certain types of mathematics itself. There's no distinction made between "overflow" and "mathematical infinity". You can o

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 2 Days 22 Hours ago by: Bart

I'll tell you anyway: it doesn't work on Windows. This is stuff I've had to do years ago. More recently, I could semi-translate C APIs (although normally I'd exclude system headers), by using a special option on my C compiler, which w

Re: What does (real) number mean?

comp.lang.c

Posted: 2 Days 22 Hours ago by: wij

The view of real number is different from common math. which clib follows: floating-point number is 'hoped' to represent real number. I just think now the symbol INFINITY should be reserved, not for signaling overflow. There is also a thr

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 3 Days 5 Hours ago by: Keith Thompson

%zu is the correct format specifier. I'm not even going to ask why you'd want to avoid it. Yes, I probably should have used `#include <sys/types.h>`. No, it's not trial and error. Write the program once, compile and run it on each pla

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 3 Days 6 Hours ago by: Bart

Sure, I can do that (after fixing the code with the right includes and avoiding %zu). But that's the trial and error approach. In the end I might end up with a list of such types for my platform, and what concrete types they actually

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 3 Days 9 Hours ago by: Keith Thompson

[...] POSIX says that off_t is a signed integer type. Is there some reason that compiling and running this program on the target system doesn't solve your problem? #include <stdio.h> #include <limits.h> int main(void) { printf("of

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 3 Days 9 Hours ago by: Bart

Because it makes sense? These types are long overdue for a clearout. I meant why wouldn't off64_t be just i64. Having off64_t be uint16_t or whatever would be perverse. some implementations may not support I want to call a C functi

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 3 Days 14 Hours ago by: Scott Lurndal

But you are a minority of one. Why should the world cater to your whims? (And no, it wouldn't be i64; some implementations may not support 64-bit integers, others may prefer an unsigned definition (although in this case, posix has speci

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 3 Days 15 Hours ago by: Bart

I do. Or more likely types such as off_t , or off64_t which are also used in applications. (Wouldn't off_t just be i64?) It's not my language that is stuck at int = 32 bits, while everything these days is 64 bits. What standards? I

preprocessor shenanigans: labels in pseudo-assembly code

comp.lang.c

Posted: 3 Days 15 Hours ago by: luser droog

I've been playing some more with my 8086 emulator which is written with a heavy use of factorization using macros (esp. X-macros). Layered on top of the emulator is a Forth interpreter written in a mixture of pre-compiled Forth code (arrays

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 3 Days 16 Hours ago by: Scott Lurndal

You are willfully ignoring what I wrote. The point is that _nobody_ cares what the underlying type of ino_t is. The point is that we learned the hard way that your solution isn't future-safe. The point is that 'struct stat' is data str

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 3 Days 17 Hours ago by: Bart

Here's my definition of struct stat as used in stat.h for my Win64 C compiler: struct _stat { unsigned int st_dev; unsigned short st_ino; unsigned short st_mode; short st_nlink; short st

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 3 Days 17 Hours ago by: Keith Thompson

Right, that's what I do now. The approach you suggest is perfectly possible and permitted by the language. Your complaint isn't about C; it's about how implementers choose to write their headers. Personally, it wouldn't affect me, sin

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 3 Days 18 Hours ago by: Scott Lurndal

We learned thirty years ago that using sized integer types instead of abstract types in struct stat (and other application<->OS APIs) was a very, very, very, very bad idea. Bart has this bugaboo about having to track down the final defi

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 3 Days 20 Hours ago by: Bart

No, you'd use: #include <sys/stat.h> If you compile on platform foo, the contents of stat.h will be relevant to foo; on bar, relevant to bar. You don't have one stat.h containing declarations for a dozen irrelevant platforms to t

Re: Corona Update 12, 22 july 2021, Finally the thruth is coming out !

comp.lang.c

Posted: 3 Days 23 Hours ago by: Doctor Who

that's a personal attack, whatever you might interpret it in favor of your snack friend. this newsgroup is full of formalism extremists and terrorists, as such it is an adverse criminal gorup. I will kill-file the whole group. fuck

Re: Corona Update 12, 22 july 2021, Finally the thruth is coming out !

comp.lang.c

Posted: 4 Days 1 Hour ago by: Öö Tiib

It wasn't attack. It was correct description of situation. There are plenty of forums where are lot of off topic posts. Sewers. Those posts are mostly rather vulgar and personal attacks between participants. Rats. What Real Troll posted w

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 4 Days 6 Hours ago by: Keith Thompson

Agreed.

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 4 Days 6 Hours ago by: Kaz Kylheku

Right, of course; but all I'm saying is that there exists a certain coding style with those typedefs, in which the typedefs do *not* signify "I am an opaque type accessed only by an API".

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 4 Days 6 Hours ago by: Keith Thompson

[...] C has those in <stdint.h> (though not by those names). The audience for most system headers is the compiler, not the programmer. I don't need to look at /usr/include/stdint.h to understand what int32_t means. Would you insist o

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 4 Days 8 Hours ago by: Keith Thompson

As I said, I've discussed my reasoning here before, but I don't mind doing so again. For me, the point is that "struct version" already has a perfectly good name: "struct version". I see no great value in giving it another name, such as

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 4 Days 8 Hours ago by: Bart

I would rather see specific types, such as i16 i32 i64. If they need to vary by platform, then provide specific headers for that platform, instead of ending up with an unmaintainable, unreadable, fragile mess by trying to have one head

Re: What does (real) number mean?

comp.lang.c

Posted: 4 Days 9 Hours ago by: wij

The correct link: (my negligence) https://sourceforge.net/projects/cscall/files/MisFiles/Infinity-en.txt/download The preliminary doc. is for a program plan. The number view is made on programmer's point of view. I thought sometimes s

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 4 Days 10 Hours ago by: Scott Lurndal

Consider abstract types such as pid_t or off_t. These allow the underlying field to change in size (e.g. from unsigned short to unsigned int) without changing the semantics of the use of the type. A simple recompile/relink is all that i

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 4 Days 10 Hours ago by: Guillaume

Okay,then certainly it's a matter of taste, and that can't be discussed. All I'm seeing though is that your argument could be used for just any type really. Any typedef "hides" the type. It's made for that. It's an abstraction. It's th

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 4 Days 12 Hours ago by: Chris M. Thomasson

[...] I still like to avoid typedefs from, time to time: __________________________________ #include <stdio.h> struct version { int major; int minor; }; void version_output( struct version const* const self ) { print

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 4 Days 12 Hours ago by: Chris M. Thomasson

[...] 100% pure nitpick... I got a bit scolded one time for using the *_t suffix in a POSIX environment. Its reserved!

Re: Corona Update 12, 22 july 2021, Finally the thruth is coming out !

comp.lang.c

Posted: 4 Days 13 Hours ago by: Doctor Who

you have means to do so peacefully, so why attack me ???????

Re: Corona Update 12, 22 july 2021, Finally the thruth is coming out

comp.lang.c

Posted: 4 Days 13 Hours ago by: Real Troll

If you want a fine sewer then go to Windows 10 newsgroup. You'll love to read their OT posts. They don't discuss anything about Windows 10 there. <news://news.eternal-september.org/alt.comp.os.windows-10> IT'S A FINE OLD SEWER THAT YOU

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 4 Days 14 Hours ago by: Keith Thompson

I disagree. I prefer to refer to the type as "struct version" and not bother with the typedef. I'm not arguing I'm right and you're wrong. It's just my preference (for which I've given reasons before). The point is that there are two

Re: What does (real) number mean?

comp.lang.c

Posted: 4 Days 14 Hours ago by: Keith Thompson

That document is in Chinese, so it won't be useful to most people. Why did you post this to comp.lang.c? It has nothing to do with the C programming language. [snip]

Re: Corona Update 12, 22 july 2021, Finally the thruth is coming out !

comp.lang.c

Posted: 4 Days 14 Hours ago by: Doctor Who

it is actually entertaining to see also off-topic posts and not only all the time technical boiler stuff. it seems you most lost your mind after revenge and unpeaceful actions, which just shows your obscure personality. my advice is :

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 4 Days 16 Hours ago by: Kaz Kylheku

I don't find that reasonable; it's pretty common to make typedef names for structures just to have a shorthand for declaring them, without intending to create a fully opaque type with abstracted operations. typedef struct version {

What does (real) number mean?

comp.lang.c

Posted: 4 Days 16 Hours ago by: wij

1. Infinity 2. Real axis 3. 'cardinality' of ℝ is greater than ℵ1,ℵ2,ℵ3,... 4. Infinite series 5. 1=√1=√(-1)*(-1)=i*i=-1. Possible issues about 0.999...=1 (or lim(x->∞) 1/x=0) had been debated for years (both are wrong). htt

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 5 Days 17 Hours ago by: John Bode

I honestly don't know how to make it any clearer. I lost time due to using the wrong syntax. I was using the wrong syntax because the information I needed in order to use the right syntax was hidden from me. That's not a function of it

Re: Corona Update 12, 22 july 2021, Finally the thruth is coming out

comp.lang.c

Posted: 7 Days 15 Hours ago by: Real Troll

Apart from kill-filing him one should also send an abuse email to his ISP. abuse@ziggo.nl These people won't understand what respect means. They will post any crap on all the newsgroups that will allow them to do so. Send an email to

Re: Corona Update 12, 22 july 2021, Finally the thruth is coming out !

comp.lang.c

Posted: 7 Days 20 Hours ago by: Öö Tiib

How you concluded that nonsense that skybuck posts is topical? All have filtered him.

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 8 Days 1 Hour ago by: Chris M. Thomasson

I missed your point. Sorry. ;^/

Re: Corona Update 12, 22 july 2021, Finally the thruth is coming out !

comp.lang.c

Posted: 8 Days 3 Hours ago by: Doctor Who

So it is off-topic here to talk about women rights and protection but on-topic to talk about pandemic ??????

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 8 Days 7 Hours ago by: Kaz Kylheku

It must be that malloc is decently optimized for very small object sizes?

Re: Corona Update 12, 22 july 2021, Finally the thruth is coming out

comp.lang.c

Posted: 8 Days 7 Hours ago by: Chris M. Thomasson

http://fractallife247.com/test/hmac_cipher/ver_0_0_0_1?ct_hmac_ciphere3b35bc9ffd1127a50e897c075a70619334aefc6107d887481c8bcd26bf95493a8ffe8465576e149ed09a1a7fbd53fa23785bb8a23307926ad0b0095f3ca5d523a9cb393789e52fc89490a1b9f79b31f0f4fd4881

Re: Corona Update 12, 22 july 2021, Finally the thruth is coming out !

comp.lang.c

Posted: 8 Days 7 Hours ago by: skybuck2000

Re: How to disambiguate macro?

comp.lang.c

Posted: 9 Days 9 Hours ago by: James Kuyper

I'm glad that you agree that it's strange, because it could be hard to convince you of that if you can't remember ever noticing it. I suspect that you have actually seen it, but failed to notice. In many cases that's not a problem:

Re: How to disambiguate macro?

comp.lang.c

Posted: 9 Days 15 Hours ago by: David Brown

Overloading on the operand types is normal : float y = (float) 4 / 3; There are some languages that overload on result type too, but they are less common. You can certainly do odd things with C++ to get a related effect, for your own

Re: How to disambiguate macro?

comp.lang.c

Posted: 9 Days 16 Hours ago by: Ben Bacarisse

There are quite a few examples of using && as a guard in K&R. How could that be clear when your example was of the compiler using the supposed commutativity of && when the operands had explicit side-effects: | So suppose you're compil

Re: How to disambiguate macro?

comp.lang.c

Posted: 9 Days 17 Hours ago by: antis...@math.uni.wr

There are languages that do overloading resolution based on result type. In language that I frequently use both are wrong: division on integers produces rational number and can not give back an integer. Similarely, division for floats ne

Re: How to disambiguate macro?

comp.lang.c

Posted: 9 Days 17 Hours ago by: Scott Lurndal

I've been programming in C since 1979, and in other languages since 1975. The use of && as a guard has been frequent and common over the last forty years. Including in Unix. grep "&&" /work/reference/usl/unix/v7/usr/src/cmd/*.c /wor

OT: possessive adjectives (Was: How to disambiguate macro?)

comp.lang.c

Posted: 9 Days 19 Hours ago by: Manfred

Sorry about the grammar nit-picking, but... The expression "it's" is a contraction for "it is", and it doesn't make sense here. What you mean here is "its", which is the proper possessive adjective to be used in this sentence. Confusi

Re: How to disambiguate macro?

comp.lang.c

Posted: 9 Days 21 Hours ago by: Bart

As I implement it, there is no actual result calculated from 'a && b' when used in 'if (a && b)'. Because once it's figured out whether the result will 1 or 0, it will also have figured out whether to do that jump or not. A && B wil

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 1 Hour ago by: David Brown

The expressions are the same in each case. After calculating "a && b", they do different things with the results - but that comes /later/. The way expressions are interpreted and evaluated is, in most languages, independent of what you

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 1 Hour ago by: David Brown

Agreed. Agreed. Here, C is the modern language!

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 2 Hours ago by: John Forkosh

Okay, thanks, that's a good example where && used as a guard is a useful construction. Hmm... and I've got to admit that it's strange I don't recall running across it. My own stuff usually looks more like, say, int myfunc ( int *ptr )

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 2 Hours ago by: John Forkosh

I've been using mostly C (and some Fortran and various assemblers) since 1984, and before that (first paying job in 1966) Fortran, various assemblers, PL/1, Cobol, Basic and some other languages you never heard of like Jovial. And as an i

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 10 Days 4 Hours ago by: dfs

That's what it started out as, but HGH took over and it bloated to the below 450 lines. Give it a try, please, and see if you can break it. There are a few TODOs in there, so it's not quite done. Use whatever word list text file

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 8 Hours ago by: Keith Thompson

[...] [...] True -- but to be fair, it is commutative-ish. For example, if a and be are non-volatile variables, then a&&b is effectively equivalent to b&&a, because neither operand has side effects. But in the general case, of course, i

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 10 Hours ago by: Stefan Ram

I can only agree with everything you (James) wrote about "&&". I remember that at one point I wrote code like try_to_do_this() && try_to_do_that() && now_try_to_do_this() && now_try_to_do_that() && now_try_to_do_this_please(); .

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 10 Hours ago by: James Kuyper

I suspect that reflects a lack of experience with C. If you had a lot of experience with C, and in particular, a lot of experience reading other people's C code, you should have noticed that code which relies upon this feature of the && a

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 11 Hours ago by: Ben Bacarisse

Not weird. That's not an expression having two meaning depending on where it's written. That one symbol with two meanings, like ',' in C (and, indeed, '=' in C).

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 12 Hours ago by: Bart

These do different things. One results in a concrete 1 or 0 boolean value. The other determines whether or not you jump to some label. I'm not good at keeping old versions of languages. But one I've just tried didn't even allow && i

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 13 Hours ago by: Manfred

This branch stemmed from the word "weird" used for a context-sensitive rule. Now, "weird" is a subjective connotation, so I think it is not surprising that someone does not see something as "weird" as I might do. In fact, it /is/ obvio

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 14 Hours ago by: David Brown

That makes little sense. In an "if", etc., your controlling expression is an expression. In an assignment, or other expression, you are using an expression. Are you suggesting that: x = a && b; if (a && b) ... are clearly differen

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 15 Hours ago by: Bart

In BASIC, "=" was used for assignments, and "=" was also used as an equality operator. Those two contexts didn't clash, so there wasn't any confusion. It's similar with the special expression that follows if, while etc; the language c

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 15 Hours ago by: Andrey Tarasevich

&& is NOT commutative in C as explained previously. && is sequenced and short-circuited. And it will always be. Then you won't be able to write (or read) normal programs in C.

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 16 Hours ago by: Scott Lurndal

And indeed it is also known as "conditional and", which implies that a false first term will prevent evaluation of subsequent terms. Although one can find useless tutorials on the web that are misleading and incomplete, if not incorrect,

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 16 Hours ago by: Ben Bacarisse

I'm don't see how this would persuade someone that it's not weird. A private language is never going to be used by someone other than the world authority on its semantics. In public-facing languages, such context-sensitive semantics se

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 17 Hours ago by: David Brown

It is perhaps not /weird/, but it is highly confusing and risky in the face of side-effects. It is a seriously bad idea. Borland Pascal (and Delphi) let you choose to make "and" (and "or") short-circuiting as an optimisation option, con

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 17 Hours ago by: Bart

That's not so weird. I used to have something similar (not in C) where 'A and B' (ie. logical and, also 'or') short-circuited in conditional expressions as used in 'if' and 'while' control expressions, which tended to be implemented wi

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 18 Hours ago by: Manfred

Just more explicit for the OP: - This behaviour is mandated by the standard. - This behaviour has been a key feature of the operator since the beginning of time, so if anything is going to change in the C standard, it's not going to be

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 18 Hours ago by: Ben Bacarisse

Minor correction. B didn't have short-circuit & and | as such, but it had a weird rule that in conditional contexts like if (a & b) ... the operator short-circuited! C rightly ditched this contextual interpretation in favour of exp

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 20 Hours ago by: Ben Bacarisse

There absolutely zero chance that the semantics of && will change like that. It is as deliberate a design choice as any in the language. Neither B nor BCPL had short-circuit logical operators, relying instead on bitwise & and |, as did

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 20 Hours ago by: David Brown

People who know C /can/ be sure about this. The only situation you need to worry about && not working as "short-circuit" is if you are dealing with badly broken, buggy, or partial C compilers. These do exist, but if you have to use one

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 21 Hours ago by: Bart

Try using (!!a) & (!!b). Or just a & b if you know that both a and b will be 0 or 1.

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 22 Hours ago by: John Forkosh

I wouldn't be too complacent about that in the future. And even today I wouldn't be so blithely sure. For example, && is commutative, i.e., a&&b == b&&a. So suppose you're compiling with -O3 optimization, and your program contains somethi

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 22 Hours ago by: James Kuyper

.... .... It's not a question of "do{xxx;} while(0);" vs. "xxx;". It's a key point of the idiom that it's "do{xxx; yyy;} while(0)" vs. "{xxx; yyy;}". A function-like macro should not include the terminating ";", because it would result i

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 22 Hours ago by: James Kuyper

.... That is a pretty fundamental feature of C; it's one of the last features of C that I would ever expect to see changed. It would break far too much existing code.

Re: How to disambiguate macro?

comp.lang.c

Posted: 10 Days 23 Hours ago by: Keith Thompson

By itself, yes, but not in the context of a macro definition (which omits the trailing semicolon, BTW).

Re: How to disambiguate macro?

comp.lang.c

Posted: 11 Days 1 Hour ago by: David Brown

Macros don't have karma. Function-like macros are occasionally useful, such as when you need to handle data of different types, or variadic macros, or where a parameter to the macro can't work as a function parameter. But if it is reaso

Re: How to disambiguate macro?

comp.lang.c

Posted: 11 Days 3 Hours ago by: John Forkosh

I just meant that the semantics of do{xxx;}while(0); is identical to just xxx; without the decoration.

Re: How to disambiguate macro?

comp.lang.c

Posted: 11 Days 4 Hours ago by: Keith Thompson

[...] The "do .. while (0)" idiom is very widely know. All C programmers *should* know about it. If the macro body is intended to be used in at statement context, that idiom is, as far as I know, the only method that actually works in a

Re: How to disambiguate macro?

comp.lang.c

Posted: 11 Days 5 Hours ago by: Andrey Tarasevich

Such "casual reader" has no business looking into such implementation details. The 'do/while(0)' idiom is so classic, well-established and universally known that anyone qualified enough to be curious about the innards of your macro wil

Re: How to disambiguate macro?

comp.lang.c

Posted: 11 Days 6 Hours ago by: John Forkosh

Thanks, again, for the alternative solution. I actually like it a little better since it avoids the klutzy do-while construction that has no useful purpose and might only confuse the casual reader, i.e., "What the heck is he doing that fo

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 11 Days 7 Hours ago by: dfs

I found the max word length of 31 before I posted, but I took the code out ---------------------------------------------------------- int wordlen = 0, maxwlen = 0; while(fgets(wordin,sizeof wordin,fwords)!=NULL) { wordlen = strlen(rtrim

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 11 Days 9 Hours ago by: Real Troll

As pointed by Stefan and others, If all you need to do is to find the largest length of the words then a simple program such as this one will also work. <==================================================================================

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 11 Days 11 Hours ago by: Michael S

I didn't do a reasonable thing. Instead, I did this: $ time ./euler-413-final1 36 1 9 9 4.104 2 20

Re: How to disambiguate macro?

comp.lang.c

Posted: 11 Days 13 Hours ago by: David Brown

We have disagreed about more than a few things in this group, Bart, but here you have eloquently described many important points and I fully agree with you.

Re: How to disambiguate macro?

comp.lang.c

Posted: 11 Days 13 Hours ago by: David Brown

Macros don't have karma. Function-like macros are occasionally useful, such as when you need to handle data of different types, or variadic macros, or where a parameter to the macro can't work as a function parameter. But if it is reaso

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 11 Days 15 Hours ago by: Mike Terry

It turned out (when I got around to it) that the change to using an associative container was indeed the performance enabler for the solution - the run time for my code is now around 6 secs, which is good enough. I also experimented w

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 11 Days 15 Hours ago by: Real Troll

I have always used something like this: clock_t t; t = clock(); char **words = loadfile(argv[1], &length); t = clock() - t; Then use a printf like so: double time_taken = ((double)t) / CLOCKS_PER_SEC; printf("loadfile took %f seconds to

Re: How to disambiguate macro?

comp.lang.c

Posted: 11 Days 16 Hours ago by: Andrey Tarasevich

Formally, you can simply make sure that your macro contains a /complete/ `if` statement #define setlink(ptr,nsew,link) if ( checknode(ptr) ) \ ((node *)(ptr))->nsew = (node *)(link); else This formally solves the origi

Re: How to disambiguate macro?

comp.lang.c

Posted: 11 Days 17 Hours ago by: Ben Bacarisse

Most C programmers won't bat an eyelid at it, but I agree it's clumsy. When the contingent action is actually just an expression, you can avoid the if (...) altogether like this: #define setlink(ptr,nsew,link) \ ( checknode(ptr) &&

Re: How to disambiguate macro?

comp.lang.c

Posted: 11 Days 18 Hours ago by: Bart

Think about when someone else needs to debug your code and wants to insert print statements or break points. OK, so not only does someone need to keep in mind whether there are 1 or N statements, there might now be 1, small N, or l

Re: How to disambiguate macro?

comp.lang.c

Posted: 11 Days 18 Hours ago by: John Forkosh

Yeah, I could avoid using a macro without any particular inconvenience, but it's kind of got the karma of a macro. Thanks, David. As you're probably seeing now, Ben suggested exactly the same thing, so I guess that's the established con

Re: How to disambiguate macro?

comp.lang.c

Posted: 11 Days 19 Hours ago by: John Forkosh

Thanks. Okay, I'll try adopting that conventional style. Looks a bit elaborate to me, but if that's the convention then I guess I can get comfortable with it. P.S. Oops, you can ignore my followup to myself -- I wrote that before your (an

Re: How to disambiguate macro?

comp.lang.c

Posted: 11 Days 19 Hours ago by: John Forkosh

Hmm... I'm thinking that maybe /* --- set north=parent,south=child,east=next,west=previous link of node --- */ #define setlink(ptr,nsew,link) if ( checknode(ptr) ) \ ((node *)(ptr))->nsew = (node *)(link); else m

Re: How to disambiguate macro?

comp.lang.c

Posted: 11 Days 19 Hours ago by: David Brown

The best solution, when you can, is to use inline (or static inline) functions instead of macros. They are clearer, nicer to write, and safer to use. But if you can't avoid using a macro, wrap the contents in a "do { ... } while (0)" lo

Re: How to disambiguate macro?

comp.lang.c

Posted: 11 Days 19 Hours ago by: Ben Bacarisse

There is a conventional idiom for this: #define setlink(ptr,nsew,link) \ do { \ if ( checknode(ptr) ) \ ((node *)(ptr))->nsew = (node

How to disambiguate macro?

comp.lang.c

Posted: 11 Days 20 Hours ago by: John Forkosh

Consider a macro of the form /* --- set north=parent,south=child,east=next,west=previous link of node --- */ #define setlink(ptr,nsew,link) if ( checknode(ptr) ) \ ((node *)(ptr))->nsew = (node *)(link) Not im

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 12 Days 2 Hours ago by: Ike Naar

Yes, 'word' has the null. And later on, 'word' is strcpy-ed into words[i], so you want words[i] to have room for the copy of 'word', including the terminating null character. It works by luck, not by design. Suppose 'word' contains the

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 11 Days 10 Hours ago by: Peter 'Shaggy' Haywo

Groovy hepcat dfs was jivin' in comp.lang.c on Tue, 20 Jul 2021 02:50 am. It's a cool scene! Dig it. That all depends on what you're actually trying to do. Reading in an array of words is a means to some end, not an end in itself. What

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 12 Days 7 Hours ago by: DFS

When I first posted the code I was running Linux (gcc) and it had no timing code so I used the standard: $ time ./loadwords wordfile I later added CLOCK_MONOTONIC_RAW timing to the source code. You probably know already that on Windo

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 12 Days 8 Hours ago by: Real Troll

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 12 Days 8 Hours ago by: Branimir Maksimovic

+1 I would do that too.

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 12 Days 9 Hours ago by: dfs

64 on 64 $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/11/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-suse-linux Configured with:

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 12 Days 9 Hours ago by: Bart

Is this a 32-bit system? Or a 32-bit compiler on a 64-bit system? If so, the largest allocation size might be 2GB, and your request was for 8GB. On a 64-bit system, you might be less lucky, and malloc won't fail even if the allocation

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 12 Days 9 Hours ago by: Bart

I choose the simplest methods too. In my script language, I read such a file like this: words := readtextfile(file) This function reads it line by line into a list of string objects (somewhere in there is a loop with fgets in it).

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 12 Days 9 Hours ago by: dfs

They're just to be read and pattern-matched against. Program is for me only. I just tested: lines = 2000000000; char **words = malloc(sizeof(char*) * lines); if(words == NULL) { printf("malloc failed\n"); exit(0); } and it fai

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 12 Days 10 Hours ago by: dfs

I did it right. Look a few lines up (you snipped it) strcpy(word,rtrim(wordin)); So 'word' already has the nul. This works. All 3 of those options compile but when run: lettermatch: malloc.c:2539: sysmalloc: Assertion `(old_to

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 12 Days 10 Hours ago by: dfs

I did that so I could load smaller and larger (and really large) files. Good points. Between Bart's and your techniques I have some good things to try. It's just the beginning of a simple linear pattern-match routine: how many word

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 12 Days 10 Hours ago by: dfs

https://github.com/dwyl/english-words file = words_alpha.txt It's sorted There's no problem, per se. Just trying to learn good techniques. Thanks. 'Very complicated' sounds like trouble. The speed I get is actually fine - who can

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 12 Days 10 Hours ago by: Andrey Tarasevich

And? In my question I'm talking about behavior of expressions of array type and how language constraints are checked against such expressions. Copying arrays wrapped in structs has nothing to do with that topic. And yes, you can copyin

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 12 Days 11 Hours ago by: Ike Naar

/* allocate one extra for the terminating null character */ memlen = strlen(word) + 1; /* words[i] contains memlen chars, not memlen pointers to char */ words[i] = malloc(sizeof(char) * memlen); /* or */ word

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 12 Days 12 Hours ago by: Scott Lurndal

Personally, I'd mmap it and make a single scanning pass over the entire set of words and build an array of offsets from the start of the map for each word; the only allocations would be required to extend the array (e.g. a vector of 32-

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 12 Days 12 Hours ago by: Stefan Ram

A lot depends on what you then want to do with those words. If they are not to be modified, but just to be read later, you can read the whole file into one region of memory and then write a NUL character after each word. If yo

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 12 Days 12 Hours ago by: David Brown

#define max_word_count 500000 #define max_word_len 32 // Load your word file with: char * word_file = malloc(max_word_count * max_word_len); fgets(word_file, max_word_count * max_word_len, fwords); // Put your words here: static char w

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 12 Days 13 Hours ago by: Bart

Well, I must have loaded a different file from yours (words.zip), with 466,000 words. The size of that file on disk (and in memory using my method) is 4.8MB, so approx 10 bytes per word on average. Allocating 32 bytes per word will us

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 12 Days 13 Hours ago by: dfs

Any thoughts on this? As fast as possible! 0.1 seconds here for (1 * 370103 = 370103) on my old system 0.5 seconds for (6 * 370103 = 2220618) Thanks for that breakdown. I'll try to replicate it. Amazing you wrote your own la

Re: Allocate length of word vs fixed length

comp.lang.c

Posted: 12 Days 14 Hours ago by: Bart

How fast do you want it? You program loaded 2.3 million words (5 combined copies of your test file) in about 1.25 seconds (on my slow PC with hard drive, but using file caching). A faster version I created did it in about 0.2 seconds

Allocate length of word vs fixed length

comp.lang.c

Posted: 12 Days 15 Hours ago by: dfs

Loaded a list of words into an array. The 370103 words came from https://github.com/dwyl/english-words file = words_alpha.txt Tested a couple memory allocation 'strategies' during loading: 1. allocate the strlen() of each word 2. alloca

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 12 Days 16 Hours ago by: MrSpud_K...@wl4yrs_t

Given I already told you I wrote my own window manager (along with half a dozen games and more utilities than I can count in the last 25 years) I'm wondering why you think I need some patronising heads up on what constitutes X11 and Xli

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 12 Days 16 Hours ago by: Lew Pitcher

You apparently misunderstand what I'm working with. X11 is a communications protocol, with the "client" end implemented in Xlib and the server end implemented in the X server. X11 doesn't have "textboxes", and it's "windows" are simply

Re: Compile-time alternative to LD_PRELOAD

comp.lang.c

Posted: 12 Days 18 Hours ago by: Manfred

I think this is one of those things where "I tried and it works" may be misleading. In my experience Linux DSO's are somewhat diverse across implementations - for example I seem to remember that selinux may disable LD_PRELOAD on some s

Compile-time alternative to LD_PRELOAD

comp.lang.c

Posted: 12 Days 19 Hours ago by: Frederick Gotham

I have a special audio driver that needs additional clean-up when the ALSA (Advanced Linux Sound Architecture) function, 'snd_pcm_close', is called. This additional clean-up can't take place inside the C code for the audio driver, and so

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 12 Days 23 Hours ago by: MrSpud_X...@nl5uzoqa

Have a look at the MacOS login screen. 2 textboxs, nothing else (for normal use), not even a window, just a background picture and a few buttons down the bottom for reboot etc.

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 13 Days ago by: Chris M. Thomasson

[...] Humm... https://secure.login.gov/ ;^)

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 13 Days ago by: MrSpud_2...@cligh74c

You can obviously add as many bells and whistles as you like, but ultimately all you need for a basic login system is username and password - 1 window, 2 textboxes. For the other stuff you don't need a drop down, you could just have them

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 14 Days 3 Hours ago by: Siri Cruise

It's easy enough if you extend the type system to include lvalueness. T Type T. &T A T lvalue. & can only appear as the outermost. *T A T pointer. (implied) &T --> T Load operator. = &T=T --> T Assign operator

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 14 Days 4 Hours ago by: Keith Thompson

Unless I'm missing something, C89/C90 didn't *prohibit* access to arrays inside rvalue structs. The idea was simply overlooked (and it is rather obscure). It says that an array expression is converted to a pointer expression that points

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird

comp.lang.c

Posted: 14 Days 6 Hours ago by: steve

[ ... this is a shameless plug ... ] I have been using giganews (http://www.giganews.com) for over 10 years and have had no problems. Sometimes you need to pay for quality service. I wouldn't be surprised if google is spamming usenet

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 14 Days 6 Hours ago by: Andrey Tarasevich

I see that I fell victim to the same confusion I'm carefully trying to avoid. Of course, there's no real conflict between 2 and 3. Value category is a property of an expression, not a property of an object. There's nothing wrong with

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 14 Days 7 Hours ago by: Ben Bacarisse

That the /intent/ is that the constraints apply after these conversions is obvious from many other common situations. For example, given int array[2]; void f(void); both *array and f() would be constraint violations unless the con

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 14 Days 8 Hours ago by: James Kuyper

.... It's not about the order in which any of the operations occur that matters. It's about whether the constraints apply before or after the conversions. Constraints are not actions, and the standard is therefore less specific about how

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 14 Days 8 Hours ago by: James Kuyper

I doubt that he's trying to "get at" anything. As I read his message, it appears that he found a clause in the standard whose purpose he did not understand, and he's asking for an explanation of it. You're reading far too much into his qu

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 14 Days 9 Hours ago by: Manfred

Probably Lesstif, which, as far as I remember, is a FOSS clone of Motif. But that was along time ago, so I may have missed some happening meanwhile.

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 14 Days 11 Hours ago by: Keith Thompson

I don't believe that's correct. `array` is an expression of array type (whether it's an lvalue or not). The standard specifies three contexts in which such an expression is not converted a pointer expression (N1570 lists 4, but it's inc

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 14 Days 11 Hours ago by: Chris M. Thomasson

I must be missing something. Fwiw, sometimes I wrap fixed arrays in structs just to be able to copy them via assignment: __________________________________ #include <stdio.h> #define FOO_N 50 struct array { int foo[FOO_N]; };

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 14 Days 14 Hours ago by: Andrey Tarasevich

That's not true. In `array = foo` the left-hand side is implicitly converted to pointer type (under assumption that constraints are checked after applying automatic implicit conversions). That is completely false. Remember that value

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 14 Days 15 Hours ago by: Kaz Kylheku

In "array = foo", there is no implicit conversion of array. It is an lvalue of array type and remains that way. If the assignment were allowed, then how it would likely work is that the "array = foo" expression, as a whole would implicit

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 14 Days 15 Hours ago by: Lew Pitcher

Not really. To satisfy a purely local login, you need a minimum of two input edit fields: a Username that echoes typed characters and a password that doesn't. If you add XDMCP into the mix (which I intend to do), you need an additional f

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 14 Days 17 Hours ago by: MrSpud_C...@atc_rakx

I should imagine most display managers are little more than a window that accepts password credentials which does credential checking and if ok simply exec's the required WM or enviroment. Personally I'd go for Motif if you can still fi

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 14 Days 17 Hours ago by: David Brown

I'm not sure I'd use the word "insisting", but that is correct. Assignment is an operator, and thus the left-hand side is an expression. 6.3.2.1p3 says: """ Except when it is the operand of the sizeof operator, or the unary & operator

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird

comp.lang.c

Posted: 14 Days 18 Hours ago by: DFS

I knocked out a simple command line reader-only in Python in no time. https://imgur.com/a/Iaai5nN Does yours show threading?

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 15 Days 1 Hour ago by: Andrey Tarasevich

No, no, no, I'm not interested in that at all. Yes, it is moot for the specific case of arrays. But at the same time it intuitively looks and feels like a more general issue. Again, what comes first: automatic implicit conversions or

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 15 Days 9 Hours ago by: Keith Thompson

I think that case is separate from what we're discussing here, though of course they're both related to the odd way C treats array expressions. This thread is about lvalues that are of array type. The struct return issue is about expres

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 15 Days 9 Hours ago by: Kaz Kylheku

If what you are getting at is this: could a C dialect provide complete support for array passing, returning and assignment, while conforming to the current standard? The answer is no. A conforming extension of behavior could be to allow

Re: Difference between C89 and other C standards

comp.lang.c

Posted: 15 Days 11 Hours ago by: Vir Campestris

As an old K&R programmer mostly using C++ that's pretty depressing. And yet there are substantial quantities of C in our codebase, and having looked through the list I seem to have picked most of it up! Andy

Re: #include

comp.lang.c

Posted: 15 Days 12 Hours ago by: Keith Thompson

[...] I think it's not so much misunderstanding as disagreement. You wrote: Whether the C standard "actually says" that the va_arg rules apply to *printf functions is, I think, not an answerable question, and in any case not

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 15 Days 13 Hours ago by: Andrey Tarasevich

The issue(s) stem from the combination of the following bits and pieces: 1. Function return is always an rvalue 2. Member array of an rvalue struct object is also an rvalue 3. The result of unary '*' is always an lvalue. And, sa

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 15 Days 13 Hours ago by: James Kuyper

The Rationale says "the fact that a[i] is a modifiable lvalue while a is not has puzzled many students of the language. A more precise description was incorporated in C89 in the hope of combatting this confusion." I have a vague memory t

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 15 Days 14 Hours ago by: Andrey Tarasevich

That's actually part of the question I was asking originally. You are implicitly insisting that the array-to-pointer conversion should be applied first, and only after that the constraints of the assignment operator should be checked.

Re: comp.lang.c blocked on Google Groups Switch to free

comp.lang.c

Posted: 15 Days 15 Hours ago by: Anton Shepelev

Regarding the reinvention of the wheel, I see nothing bad in it as it helps you understand the wheel better than *any- body* who have never (re)invented one, and perhaps even to improve upon the original. Since there are so many

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 15 Days 16 Hours ago by: Lew Pitcher

Sorry, but I must make a correction here: I have no interest (at this time) in writing a Window Manager (WM) client for X11. The O'Reilly X11 Xlib book discusses WMs in detail, and includes the code for a rudementary WM implemented in Xl

Re: naked switches

comp.lang.c

Posted: 15 Days 17 Hours ago by: Scott Lurndal

The compiler generates optimal code[*]. The source is descriptive and far more readable (and less subject to error) than manual bit shifting/masking. I don't see a problem. [*] As inline functions, they're translated with the rest of

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 15 Days 21 Hours ago by: Christian Gollwitzer

Oh he's quite busy to tell the people over at the Python group that their language is a bag of shite and slow as hell and that everything will change once he finished the frontend for his fancy compiler. Needless to say that there isn'

Re: naked switches

comp.lang.c

Posted: 15 Days 21 Hours ago by: Tim Rentsch

Ahh, rather like using an elephant gun to shoot a field mouse.

Re: naked switches

comp.lang.c

Posted: 15 Days 21 Hours ago by: Tim Rentsch

To extract a "field" from expression 'e' of width 'w' at position 'p' #define FIELD(e,w,p) ( (e)>>(p) & ( ( (0?(e):1) << (w)-1 ) -1) *2 +1 ) The idiom (0?(e):1) produces the value 1 in a type wide enough to mask a field in the ex

Re: Difference between C89 and other C standards

comp.lang.c

Posted: 15 Days 21 Hours ago by: Tim Rentsch

Sorry, I don't remember anything else beyond what I described above.

Re: #include

comp.lang.c

Posted: 15 Days 21 Hours ago by: Tim Rentsch

I think you misunderstood what I was saying. There is no question about what words are present. What the words mean is another story. In many cases if not most cases the meaning of sentences written in English is at least partly subje

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 15 Days 22 Hours ago by: MrSpud_8...@ko9uz7rn

It depends how much you want your WM to do. I did it in pure Xlib and implemented button and menu widgets (thats all thats really needed) from scratch which frankly isn't too hard. But sure, if you want a WM thats actually useful you'll

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 15 Days 22 Hours ago by: Keith Thompson

I think that both of the previous posters in this thread, Ben and Öö, have correctly said essentially the same think you're saying, that `a` (after the array-to-pointer conversion) is not an lvalue at all. I'm not sure that anyone here

Halting problem and self-reference (liar paradox)

comp.lang.c

Posted: 15 Days 23 Hours ago by: wij

// [Syn] Decide whether the function %f, given the argument %a, will halt or not, // // [Ret] true: f(a) will halt // false: otherwise // // Note: %f is ANY program of the machine // bool H(Func f, Arg a); Quick answer: By GUA http

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 16 Days ago by: David Brown

As far as I can tell (there are others here that are better than I at interpreting the exact wording of the standards), the wording in the standard has been misinterpreted here. The standard says "A modifiable lvalue is an lvalue that do

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 16 Days 9 Hours ago by: Öö Tiib

Yes, but that does not matter that there are no features or concepts in C. After figuring that array decays to pointer a novice tries to modify that pointer sooner or later. Sometimes "successfully" as array "parameter" is actually a poin

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 16 Days 10 Hours ago by: Öö Tiib

Yes and so a = b is invalid because a turns into something that is not lvalue at all. But saying that it is not modifiable does not hurt? Thanks for clarifying. I don't think that it is bad when standard repeats something over even if

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 16 Days 10 Hours ago by: Andrey Tarasevich

Um... I don't see what you are trying to say here. There's no such concept in C as "modifying an address of an exiting object". No need to block or prevent it, for arrays or for anything else.

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 16 Days 11 Hours ago by: Ben Bacarisse

Yes, you've missed the point of the question. Lvalue expressions of array type are, in almost all situations, converted to pointers to the first element of the array, and *the result is no longer an lvalue*. (The exceptions are the oper

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 16 Days 11 Hours ago by: Keith Thompson

My first thought is that the statement is redundant (and that's not necessarily a bad thing). Other requirements imply that you can't assign to arrays, but it doesn't hurt to have an explicit statement to that effect. The full definitio

Re: Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 16 Days 11 Hours ago by: Öö Tiib

It is so that we can't modify address of array so rest of operators that can modify lvalue like ++ or += also will be rejected on case of an array. But I might misunderstand what you are asking.

Array is an non-modifiable lvalue - where does it matter?

comp.lang.c

Posted: 16 Days 11 Hours ago by: Andrey Tarasevich

6.3.2/1 says that 1 [...] A modifiable lvalue is an lvalue that does not have array type, [...] Based on that, arrays are non-modifiable lvalues. We all know what it actually means. But is there any context in the standard in which t

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 16 Days 16 Hours ago by: Malcolm McLean

I built Baby X, oriignally, as the name suggests, as a higher-level layer of abstraction over Xlib. I then ported it to Windows so Baby X programs can run under either Linux (any maybe other Unices) and Windows. A medium-level GUI toolki

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 16 Days 17 Hours ago by: Lew Pitcher

Thanks for the best wishes. Yah, I'm about 50 pages into the Xlib manual, and have completed (and played with) the basicwin example. And then, I left the manual alone, except for the reference information. I quickly found that Xlib alo

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 16 Days 17 Hours ago by: MrSpud_6...@1h0c.net

The source of another window manager would be a lot more useful IMO as looking at the source of the above won't show you how to use the required APIs without doing some reverse engineering nor will it show you what to use when.

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 16 Days 17 Hours ago by: Scott Lurndal

Hm.. All the X11Rx code is open source; it's easy enough to use the source of libX11, libXt, and libXaw as a reference.

Re: Sluts Near Me for Local Fuck | Horny Local Sluts

comp.lang.c

Posted: 16 Days 22 Hours ago by: james marting

Down for hook up – – 32

Re: Online Dating Where Single Women, Men Looking Each Other for Date

comp.lang.c

Posted: 16 Days 22 Hours ago by: james marting

Going to be in San Angelo around the 10th of August. Give me a shout if you want some fun!

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 16 Days 23 Hours ago by: MrSpud_0...@uncf5cot

Good luck with that (genuinely, I'm not being sarcastic). I wrote one about 20 years ago and it was a fun project to do but the problem was that even the venerable O'Reilly XLib manuals didn't provide all the information required as they'

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups Switch to free (Thunderbird)

comp.lang.c

Posted: 16 Days 23 Hours ago by: MrSpud_...@em8kceu_4

The irony of mentioning Linux there. But you probably won't get it :) It doesn't do everything I need. Given writing software to get and post articles on usenet isn't exactly arduous (providing you understand networking) and that it was

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 17 Days 11 Hours ago by: Kenny McCormack

I'd be interested to know more about that (as a cyclist myself). Also, this whole sub-thread about re-inventing trn, makes me think of a certain frequent poster who is always going on about how he's gonna re-invent everything. Haven't h

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups Switch to free (Thunderbird)

comp.lang.c

Posted: 17 Days 11 Hours ago by: Eli the Bearded

I get the impression from news.software.readers that when people post about creating new newsreaders these days the are looking for features you don't get in tin/trn. Things like working well with multiple news servers (track reading by m

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 17 Days 12 Hours ago by: Kaz Kylheku

Someone is reinventing the literal wheel right now in the world of high end bicycles, though.

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 17 Days 12 Hours ago by: Lew Pitcher

I can think of many possible reasons to (re)create an existing tool: - the existing tools do not provide the functionality you require, or - the existing tools do not provide the usability you require, or - you wish to incorporate the to

Re: Wheel re-invention (Was: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 17 Days 13 Hours ago by: Manfred

Don't forget how cool is the wheel :)

Wheel re-invention (Was: comp.lang.c blocked on Google Groups Switch to free (Thunderbird)

comp.lang.c

Posted: 17 Days 13 Hours ago by: Kenny McCormack

There's no need to. Really, talk about wheel re-invention. Hey, here's an idea, why not write a new OS? Who needs Linux? Who need z/OS? (etc) trn (and similar, such as "tin") does everything you need, so why not use it? You'd spend

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird

comp.lang.c

Posted: 17 Days 16 Hours ago by: MrSpud...@rm5.biz

Maybe some people have, but I get the impression most haven't.

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird

comp.lang.c

Posted: 17 Days 17 Hours ago by: Scott Lurndal

What makes you think we haven't?

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird

comp.lang.c

Posted: 18 Days ago by: MrSpud_0...@1luxp5mj

Given how many apparent geniuses subscribe to comp.lang.c++ I'm amazed none of them have written their own newsreader. NNTP is quite a simple protocol after all. I did and I'm using it now. Ok, its command line, not GUI but it does the jo

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 18 Days 10 Hours ago by: Ben Bacarisse

Ah, right. Thanks. I think you did say that already.

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird and eternal-september)

comp.lang.c

Posted: 18 Days 14 Hours ago by: Scott Lurndal

Nope. See headers. Mine will save cancelled posts to ~/dead.letter however.

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird

comp.lang.c

Posted: 18 Days 15 Hours ago by: Real Troll

Surely, all news client must have a facility to save messages somewhere when the user sends something. Even in the 90s when Netscape and Outlook Express were two GUI news clients had a facility to save messages in sent folder. Now in

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 19 Days ago by: Michael S

Yes, even the very first totally unoptimized (by later standards) variant calculates 1-1e19 in 6s consuming ~20MB of RAM.

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird

comp.lang.c

Posted: 19 Days 3 Hours ago by: Kenny McCormack

Yeah, but... That works reasonably well, provided you are talking about the world, post, say, about 2010, and that you are, in fact, using a Windows GUI newsclient thingie, like, say, Thunderbird. But, remember, the poster in question s

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 19 Days 8 Hours ago by: luser droog

Another option to think about for the "free(pss)" part. You might also consider using `realloc()` for repeated temporary allocations like this. This probably isn't a drop-in replacement for your specific code, unfortunately. But it's a

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 19 Days 11 Hours ago by: Ben Bacarisse

.... This is very impressive. Barvo! I've not looked at your explanation just in case the mood takes me to have think about this myself, but I am curious abut one thing... Does your method bring the compute resources for the 1-10^19 c

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 19 Days 13 Hours ago by: Michael S

Observation #4 proved to be rather important. After I took advantage of it, the size of the data set (for nDigits() shrunk by factor of 7. Execution time also improved. As a result, I managed to calculate result for nDigits1. nDigits2 was

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 19 Days 15 Hours ago by: Mike Terry

CORRECTION: "1103" : <2000> as in the following explation, not <0002>.

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 19 Days 16 Hours ago by: Mike Terry

.... Right, what you say below is effectively the logic for my solution, but my implementation was a bit crappy. I was using a number of huge arrays where you were using associative containers. At the time I thought the associative c

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 19 Days 22 Hours ago by: Michael S

Let's see. My solution is based on following observations: Observations 1. When the numbers are split in n-digit prefix and s-digit suffix then the amount of 1-child numbers for all possible suffixes of specific prefix depends on numbe

Re: Difference between C89 and other C standards

comp.lang.c

Posted: 20 Days ago by: Keith Thompson

[...] Of course he (or she) is trolling. He's demonstrated enough knowledge of C in his previous posts that it cannot be from ignorance. You may recall that he recently claimed that there's a possible race condition in a simple program

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 20 Days ago by: Michael S

Update: Bigger gear easily calculated 27, 28 and 30 digits, but was running out of memory at 29 digits. In order to crack it I had to make several changes to data structures. The changes made thing a little slower, but brought peak memory

Re: Difference between C89 and other C standards

comp.lang.c

Posted: 20 Days ago by: David Brown

He is trolling you Keith, I think. He is specifically avoiding giving the versions to which he is referring. In case he is just ignorant, here is an approximate summary: From C89 to C90, the changes are just formality in the text (unle

Re: Distinction between identical struct types

comp.lang.c

Posted: 20 Days 4 Hours ago by: Richard Damon

You are only allowed to define a give type ONCE in a translation unit. That is a standard rule in C. The compiler isn't required to check if two definitions are somehow the same, it is always an error to define a given type twice. Thus,

Re: Difference between C89 and other C standards

comp.lang.c

Posted: 20 Days 4 Hours ago by: Kli-Kla-Klawitter

No, I'm not lying. The newer versions are just bugfixes.

Re: Difference between C89 and other C standards

comp.lang.c

Posted: 20 Days 9 Hours ago by: Keith Thompson

Any chance you could be more specific?

Re: Difference between C89 and other C standards

comp.lang.c

Posted: 20 Days 9 Hours ago by: Keith Thompson

If you're saying there are no differences between C89 and C99, C11, et al, then you are lying. (I say this based on some of your previous posts.)

Re: #include

comp.lang.c

Posted: 20 Days 9 Hours ago by: Keith Thompson

I mostly agree, but I disagree with your statement about the va_arg rules applying to *printf. The standard doesn't say that the *printf functions use va_arg. The question of whether the standard *actually says* that va_arg rules apply

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 20 Days 16 Hours ago by: Mike Terry

I've also worked out a "solution", and it agrees with your table above. I'm not sure it counts, though, as it runs MUCH slower than yours! E.g. for the 19-digit calculation it takes around 4 minutes per digit (so over an hour for the

Re: naked switches

comp.lang.c

Posted: 20 Days 17 Hours ago by: Robert Finch

I use the bit-slicing notation in part because the compiler I am using is not very sophisticated. It cannot determine from a group of shifting and masking operations what bitfield instruction to use. It does not have very sophisticated pa

Re: General Undecidable Axiom(2021 WIJ)

comp.lang.c

Posted: 20 Days 17 Hours ago by: wij

Which one? Do you mean "Copyright 2021 WIJ"? (this one must be visible to prevent from hijack) Are one line of statement and two C-examples not enough? From Olcott's Incident, I am surprised that many 'C/C++ programmers' do not really

Re: naked switches

comp.lang.c

Posted: 20 Days 18 Hours ago by: Scott Lurndal

In the C++ world, we use this: namespace bit { template <class T> static inline T maskT(size_t bits) { if (bits >= sizeof(T)*8) return -1; else return ~(static_cast<T>(-1)<<bits); }

Re: Difference between C89 and other C standards

comp.lang.c

Posted: 20 Days 20 Hours ago by: Kli-Kla-Klawitter

There's no differnce. The newer versions are just bufixed specs.

Re: Difference between C89 and other C standards

comp.lang.c

Posted: 20 Days 22 Hours ago by: Tim Rentsch

They are almost but not quite the same language. There are a few minor differences that I ran across accidentally some time ago while looking at the two sort of side-by-side. I don't remember what any of the differences are, except tha

Re: #include

comp.lang.c

Posted: 20 Days 22 Hours ago by: Tim Rentsch

I wrote a long reply to Ben Bacarisse in this same thread, you may want to read that reply in addition to what I write here. Basically the question boils down to what is meant by the somewhat vague phrase "the correct type". I believe

Re: #include

comp.lang.c

Posted: 20 Days 23 Hours ago by: Tim Rentsch

I believe the rule about variadic arguments applying to printf arguments is both what was intended and how the C standard is generally read by others, including in particular implementors. Consider two possibilities: One: the rules for

Re: General Undecidable Axiom(2021 WIJ)

comp.lang.c

Posted: 20 Days 23 Hours ago by: Ben Bacarisse

It's better to trim sigs. Mine's short, but even so... The list of things every C programmer should know that are not topical on comp.lang.c is almost endless. Anyway, I won't go on about it. Like PO you don't want to stay on-topic

Re: naked switches

comp.lang.c

Posted: 21 Days ago by: Tim Rentsch

No typeof is needed, nor _Generic, nor type name argument, nor forcing a width of 64 bits, to define a macro that produces an "and" of the appropriate size with a compile-time constant (as evidenced by both gcc and clang with -O0). Just

Re: naked switches

comp.lang.c

Posted: 21 Days ago by: Tim Rentsch

Another way, assuming the mask width desired is greater than zero, is this ((1LLU << width-1) -1) *2 +1 which works great if 'width' is a compile-time constant.

Re: Why does C allow structs to have a tag?

comp.lang.c

Posted: 21 Days ago by: Tim Rentsch

I stand by my earlier claim that the culprit here is C++ rather than typedefs.

Re: Which side of bitwise OR is evaluated first?

comp.lang.c

Posted: 21 Days ago by: Tim Rentsch

Obviously the code was not unreadable, since many people here were able to read it without too much difficulty. The author too was, rather obviously, able to read it. Some people might believe that some other, unspecified, people would

Re: How do we know that H(P,P)==0 is correct? (V4) [ strachey example ]

comp.lang.c

Posted: 21 Days 4 Hours ago by: olcott

Wouldn't it be worth the slight annoyance of a little cross-posting if the cross-posting made the difference between actually validating that the halting problem proofs really have been correctly refuted?

Re: General Undecidable Axiom(2021 WIJ)

comp.lang.c

Posted: 21 Days 5 Hours ago by: wij

Recently the 'nation' concept in my place has been manipulated vaguely. I would like the full name: Republic Of China (Taiwan)

Re: General Undecidable Axiom(2021 WIJ)

comp.lang.c

Posted: 21 Days 5 Hours ago by: Real Troll

He is the same guy who has been flooding this newsgroup. This time he used a VPN and the posting was done through a service in Taiwan. The link given in the post is the clue. Who in their right mind would know that 2004 link! I think w

Re: General Undecidable Axiom(2021 WIJ)

comp.lang.c

Posted: 21 Days 5 Hours ago by: wij

The axiom GUA is the computation theory EVERY C programmer should know. Because of olcott's case, I think 'some' C programmer may be not be clear about the essential general idea and make programming mistakes. https://groups.google.com/

Re: General Undecidable Axiom(2021 WIJ)

comp.lang.c

Posted: 21 Days 5 Hours ago by: Ben Bacarisse

Why did you post this here? You should consider topicality if you want to be a good netizen.

Re: General Undecidable Axiom(2021 WIJ)

comp.lang.c

Posted: 21 Days 6 Hours ago by: wij

The construct of P (proof of General Undecidable Axiom) is 100% correct, intuitive and above all, REPRODUCIBLE, VERIFIABLE. // [Ret] true: f has the (dynamic)property Q // false: otherwise bool U(Func f); void P() { if(U(P)) {

Re: [ Abuse ] abuse@giganews.com

comp.lang.c

Posted: 21 Days 6 Hours ago by: Öö Tiib

Nah that individual is documented to believe being supernatural. <https://www.youtube.com/watch?v=wfPPJBYc2B0> So better not to reply to him nor discuss him unless you are specialist of that kind of individuals.

Re: How do we know that H(P,P)==0 is correct? (V4) [ strachey example ]

comp.lang.c

Posted: 21 Days 7 Hours ago by: olcott

Flibble is only reviewing my work because I cross-posted and it turns out that he is a great reviewer. Kaz Kylheku only reviewed my work because I cross-posted and he is my best reviewer so far.

Re: How do we know that H(P,P)==0 is correct? (V4) [ strachey example ]

comp.lang.c

Posted: 21 Days 7 Hours ago by: Kenny McCormack

Like you did?

Re: [ OT ] C - Open Standards

comp.lang.c

Posted: 21 Days 9 Hours ago by: Cholo Lennon

I always return to this page when I need a reference/link to some particular C/C++ standard document: https://stackoverflow.com/questions/81656/where-do-i-find-the-current-c-or-c-standard-documents -- Cholo Lennon Bs.As. ARG

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 21 Days 9 Hours ago by: Michael S

I did the change to counters, extending them to 128 bit, but left the rest of fields, in particular keys, at 64 bit, so this variant can go to 31 digits, but not above. On my old home PC with 8 GB of RAM it chocked at 27 digits. Now I am

Re: How do we know that H(P,P)==0 is correct? (V4) (Ben, Kaz or Mike please talk to Flibble)

comp.lang.c

Posted: 21 Days 9 Hours ago by: olcott

I need Kaz or Mike to respond to Flibble's post. My best reviewer: Kaz only responded to my posts because I posted to comp.lang.c and several other language groups. My cancer is at stage 3, I want to get my work approved before I die.

Re: How do we know that H(P,P)==0 is correct? (V4) [ strachey example ]

comp.lang.c

Posted: 21 Days 9 Hours ago by: Keith Thompson

[196 lines deleted] *Please* stop cross-posting this stuff to comp.lang.c, or to any group other than comp.theory. I know it's olcott who insists on adding irrelevant newsgroups, but I don't see his posts. Please edit the Newsgroups: he

[ Abuse ] abuse@giganews.com

comp.lang.c

Posted: 21 Days 9 Hours ago by: Real Troll

Can everybody please send an abuse email to: abuse@giganews.com so that we can "halt" the useless posts flooding this newsgroup. I have calculated that there are 113 posts since 2nd July, 2021 and rising. We need to take drastic action b

Re: Olcott's theory (Ben, Kaz or Mike please talk to Flibble)

comp.lang.c

Posted: 21 Days 10 Hours ago by: olcott

It transforms what was previously thought to be known as a definite limit to all computation into no known limit to computation. This is huge.

Re: Olcott's theory (Ben, Kaz or Mike please talk to Flibble)

comp.lang.c

Posted: 21 Days 10 Hours ago by: olcott

None-the-less once the halting problem is no longer provably undecidable computation loses its definite limits. The key other aspect of this is that the Tarski undefinability theorem can be understood to fail for the same reason that t

Re: Distinction between identical struct types

comp.lang.c

Posted: 21 Days 10 Hours ago by: james...@alumni.calt

First, what the relevant rules are: The key point is that "The presence of a struct-declaration-list in a struct-or-union-specifier declares a new type, within a translation unit." (6.7.2.1p8). Note that it is a new type, distinct from an

Re: Olcott's theory (Ben, Kaz or Mike please talk to Flibble)

comp.lang.c

Posted: 21 Days 11 Hours ago by: olcott

Like I already explained in much more words with many more key details, if none of these conventional (Strachey based) undecidability proofs are correct then that doesn't seem to leave any other proof of halting undecidability: Goldba

Re: Olcott's theory

comp.lang.c

Posted: 21 Days 11 Hours ago by: olcott

All of the proofs seem to boil down to this one idea: An impossible program C. Strachey The Computer Journal, Volume 7, Issue 4, January 1965, Page 313, https://doi.org/10.1093/comjnl/7.4.313

Re: Distinction between identical struct types

comp.lang.c

Posted: 21 Days 12 Hours ago by: Bart

Making them proper types is a big deal. Before you know it, you will have to implement half of C++ or Ada to deal with type hierarchies, inheritance and the rest: typedef int T; typedef int U; T a; U b; What happens with a+

Re: Distinction between identical struct types

comp.lang.c

Posted: 21 Days 12 Hours ago by: Malcolm McLean

A point and a vector both have the same fields. However if you declare both a struct point and a struct vector in the same program, then presumably you want to enforce the distiction between them. Subtracting two points yields a vector, fo

Re: Distinction between identical struct types

comp.lang.c

Posted: 21 Days 12 Hours ago by: Andrey Tarasevich

Because in C a struct declaration is a type declaration, which introduces a new named type `struct <tag>`. Syntactic constructs that describe function type (or function pointer type) are not type declarations. They do not introduce ne

Re: Olcott's theory (Ben, Kaz or Mike please talk to Flibble)

comp.lang.c

Posted: 21 Days 12 Hours ago by: Mr Flibble

Then you might be on to something but you need to stop implying the halting problem itself is not undecidable in your posts as it doesn't help your case (and is the reason I have been dismissive of your posts in the past). /Flibble

Re: Olcott's theory (Ben, Kaz or Mike please talk to Flibble)

comp.lang.c

Posted: 21 Days 12 Hours ago by: olcott

None-the-less everyone else does get that impression. All of the textbook halting problem undecidability proofs rely on the Strachey form as their entire basis. http://www.liarparadox.org/sipser_165.pdf

Re: Distinction between identical struct types

comp.lang.c

Posted: 21 Days 12 Hours ago by: Thiago Adams

Not exactly. Let's say some pragma affects the struct layout. The compiler has it own way to compare internally. Sorry I wasn't clear..I mean some decisions made for the C language may be because they are the easiest way to implement.

Re: Olcott's theory (Ben, Kaz or Mike please talk to Flibble)

comp.lang.c

Posted: 21 Days 13 Hours ago by: Mr Flibble

When I read Strachey's letter I didn't get the impression that that was his conclusion; merely that T cannot decide on P if called from within P .. i.e. the "Impossible Program". /Flibble

Re: Olcott's theory (Ben, Kaz or Mike please talk to Flibble)

comp.lang.c

Posted: 21 Days 13 Hours ago by: olcott

Yes and he and everyone else here besides you and I believes that this proves that the halting problem is undecidable.

Re: Olcott's theory

comp.lang.c

Posted: 21 Days 13 Hours ago by: olcott

All of the textbooks cite the Strachey form as proof that the halting problem is undecidable. Ben, Mike and Kaz agree that the Strachey form proves that the halting problem is undecidable. rec routine P §L:if T[P] go to L Retu

Re: Olcott's theory

comp.lang.c

Posted: 21 Days 14 Hours ago by: olcott

*I agree that I have not solved the halting problem* At most I have only proved that the conventional proofs of the undecidability of the halting problem that rely on the Strachey form, are incorrect. This seems to include all textbook

General Undecidable Axiom(2021 WIJ)

comp.lang.c

Posted: 21 Days 14 Hours ago by: wij

Since the conventional HP only mentions a specific halting problem, which is often believed to be an invalid proof. See https://groups.google.com/g/comp.theory/c/RO9Z9eCabeE/m/Ka8-xS2rdEEJ I hereby claims the General Undecidable Axiom(202

Re: Olcott's theory

comp.lang.c

Posted: 21 Days 15 Hours ago by: olcott

[An impossible program] C. Strachey The Computer Journal, Volume 7, Issue 4, January 1965, Page 313, https://doi.org/10.1093/comjnl/7.4.313 https://academic.oup.com/comjnl/article/7/4/313/354243 No I never made that mistake, My goal si

Re: naked switches

comp.lang.c

Posted: 21 Days 15 Hours ago by: Bart

It would be of use to the manufacturer who provides the header file. But I'm not sure your example is correct; if clocksource is a bitfield of timer.controlreg, it would only set it to 4 if it's currently zero (or already 4). What do

Re: How do we know that H(P,P)==0 is correct? (V4) [ strachey example ]( You and I )

comp.lang.c

Posted: 21 Days 15 Hours ago by: olcott

You can check around. You and I are the only one's here that hold that view. Ben, Kaz, and Mike would all disagree with you and I on this point.

Re: How do we know that H(P,P)==0 is correct? (V4) [ type mismatch

comp.lang.c

Posted: 21 Days 15 Hours ago by: olcott

Until the behavior of its input proves that it will never halt every H remains a pure simulator of this input. When its input does prove that it will never halt H suspends the execution of this input, thus this non-halting input never

Re: Distinction between identical struct types

comp.lang.c

Posted: 21 Days 15 Hours ago by: Stefan Ram

.... The presence of a struct-declaration-list in a struct-or-union-specifier declares a new type, within a translation unit. This enables a programmer to specify different struct types with the same layout but different s

Re: How do we know that H(P,P)==0 is correct? (V4) [ strachey example

comp.lang.c

Posted: 21 Days 16 Hours ago by: olcott

I have been saying that they are invalid since 2004, now you are agreeing with me on this. comp.theory Peter Olcott Sep 5, 2004, 11:21:57 AM The Liar Paradox can be shown to be nothing more than a incorrectly formed statement because of

Re: Distinction between identical struct types

comp.lang.c

Posted: 21 Days 16 Hours ago by: Bart

Are you talking about comparing /source code/? Anyway it's debatable whether member names must match. For the purposes of copying struct A to struct B, only layout and types need to match. Member names are only important when accessi

Re: naked switches

comp.lang.c

Posted: 21 Days 16 Hours ago by: David Brown

I don't use macros like GETBIT, no. Most often, I use the method defined by the microcontroller manufacturer that provided the header file for accessing the hardware registers for the microcontroller. Sometimes that is bit-field structs,

Re: How do we know that H(P,P)==0 is correct? (V4) [ type mismatch error ]

comp.lang.c

Posted: 21 Days 16 Hours ago by: olcott

No P ever halts while every H remains a pure simulator thus meeting the conventional criteria of UTM equivalence for never halting. Until we remove the [liar paradox] pathological self-reference(Olcott 2004) error from the halting pro

Re: How do we know that H(P,P)==0 is correct? (V4) [ strachey

comp.lang.c

Posted: 21 Days 16 Hours ago by: Mr Flibble

I agree, if these proofs do require a decider to be part of that which is being decided then they are indeed invalid for the reason Strachey highlights in his letter. /Flibble

Re: How do we know that H(P,P)==0 is correct? (V4) [ strachey example

comp.lang.c

Posted: 21 Days 16 Hours ago by: olcott

Although this <is> one way of putting it, all of the halting problem proofs require that the decider is a part of what is being decided. When we disallow that all of these proofs lose their entire basis and fail to prove anything.

Re: How do we know that H(P,P)==0 is correct? (V4) [ strachey

comp.lang.c

Posted: 21 Days 16 Hours ago by: Mr Flibble

I repeat: all Strachey's letter shows is that a decider cannot be part of that which is being decided. /Flibble

Re: Distinction between identical struct types

comp.lang.c

Posted: 21 Days 17 Hours ago by: Thiago Adams

Ignore all spaces for instance and compare attributes. In this case the type, name and order of the members must match. One justification could possible be just because this is simple to do? This justification maybe is applied to typ

Re: How do we know that H(P,P)==0 is correct? (V4) [ strachey example

comp.lang.c

Posted: 21 Days 17 Hours ago by: olcott

// Simplified Linz Ĥ (Linz:1990:319) void P(u32 x) { u32 Input_Halts = H(x, x); if (Input_Halts) HERE: goto HERE; } int main() { u32 Input_Halts = H((u32)P, (u32)P); Output("Input_Halts = ", Input_Halts); } What it sh

Re: How do we know that H(P,P)==0 is correct? (V4) [ pathological

comp.lang.c

Posted: 21 Days 17 Hours ago by: olcott

Every H in the nested simulations of P(P) only acts as a pure simulator on its input until after it makes its halt status decision. This means that every H Every H in the nested simulations of P(P) can always screen out its own entire

Re: naked switches

comp.lang.c

Posted: 21 Days 18 Hours ago by: Bart

Maybe you're too used with dealing with bit manipulation using code like your examples below. I guess you don't use macros like GETBIT, as that would mean you do find it useful. OK, I'll try to translate your examples (into my synta

Re: naked switches

comp.lang.c

Posted: 21 Days 18 Hours ago by: David Brown

No, it is because bit-fields like this are not commonly useful. I really don't see that. And I do the kind of work where it would be most likely to be useful. (I would have liked clearer specifications of bit-field layout in C.) Why

Re: Distinction between identical struct types

comp.lang.c

Posted: 21 Days 19 Hours ago by: Bart

What's the algorithm for determining whether two structs are compatible? It would need to deal with differently named fields, locally defined types, local values of pack(), anonymous unions etc. However, some want to use structs in ord

Distinction between identical struct types

comp.lang.c

Posted: 21 Days 19 Hours ago by: Thiago Adams

Does anyone know or can see a reason why the C language makes distinction between identical struct types? Like this: void F(struct {int i; }* p){} int main() { struct { int i; } s; F(&s); } Compare with functions: void F(voi

Re: naked switches

comp.lang.c

Posted: 21 Days 20 Hours ago by: Bart

It's probably rare because the language doesn't support them! If available, they would be used a lot more. (As you've said, the macro to set the value of an arbitrary bitfield is not trivial.) C does have bitfield indexing, but only

Re: naked switches

comp.lang.c

Posted: 21 Days 20 Hours ago by: David Brown

In a programming language, you want convenient syntax for things you do a lot, and you can happily have inconvenient syntax for things you only need to do occasionally. (This works the other way too - you pick a language that has conveni

Re: naked switches

comp.lang.c

Posted: 21 Days 21 Hours ago by: David Brown

Not in C, no - there is not really any need. (You get that kind of thing in hardware design languages, as it is useful in programmable logic and chip design).

Re: naked switches

comp.lang.c

Posted: 21 Days 23 Hours ago by: David Brown

In gcc's internal tree representation of code, they have a node type for "undefined behaviour", which is used in some passes to establish facts about expressions and values, such as possible ranges for data, and it is used to eliminate br

Re: How do we know that H(P,P)==0 is correct? (V4) [ pathological self-reference(Olcott 2004) ]

comp.lang.c

Posted: 22 Days 3 Hours ago by: olcott

When one of the function calls of infinite recursion is aborted the infinite recursion also stops running but this does not count as halting because the only reason that any of it ever stopped running is that one of the links of the in

Re: How do we know that H(P,P)==0 is correct? (V4) [ pathological

comp.lang.c

Posted: 22 Days 4 Hours ago by: olcott

The above axiom is provided by the definition of a UTM, thus neither provable nor something new. It is like all axioms a stipulated definition. P(P) specifies an infinite set of nested simulations that never halts unless one of the in

Re: How do we know that H(P,P)==0 is correct? (V4) [ pathological self-reference(Olcott 2004) ]

comp.lang.c

Posted: 22 Days 4 Hours ago by: olcott

What everyone consistently ignores is that only the prefix of the computation runs independently. If the suffix of this computation was not aborted then P(P) would never halt. Simulating halt decider H is only answering the question: W

Re: How do we know that H(P,P)==0 is correct? (V4) [ pathological self-reference(Olcott 2004) ]

comp.lang.c

Posted: 22 Days 6 Hours ago by: olcott

One of my best reviewers [Kaz Kylheku] came from comp.lang.c and would have never reviewed my work unless he saw it in comp.lang.c

Re: How do we know that H(P,P)==0 is correct? (V4) [ pathological self-reference(Olcott 2004) ]

comp.lang.c

Posted: 22 Days 7 Hours ago by: olcott

Simulating halt decider H is only answering the question: Would the input halt on its input if H never stopped simulating it? An answer of "no" universally means that the input never halts. An answer of "yes" universally means that the

Re: How do we know that H(P,P)==0 is correct? (V4) [ pathological self-reference(Olcott 2004) ]

comp.lang.c

Posted: 22 Days 8 Hours ago by: olcott

A computation that stops running because it has been aborted is as Richard put it suspended, and not halted. When-so-ever the pure simulation of an input on its input never halts then this input never halts. When-so-ever any input to

Re: naked switches

comp.lang.c

Posted: 22 Days 9 Hours ago by: Bart

I thought this was for a small device! A switch of 334K to 1000K case labels is some switch statement, even if machine-generated. And also quite a hefty function body of at least 1 million lines for 1M labels. I use a limit of 1000 lab

Re: How do we know that H(P,P)==0 is correct? (V4) [ pathological

comp.lang.c

Posted: 22 Days 9 Hours ago by: olcott

The reason that H cannot return the correct halt status to P is that this TM / input pair was intentionally modeled on the basis of the liar paradox. The liar paradox is not a truth bearer because it is self-contradictory. Any express

Re: naked switches

comp.lang.c

Posted: 22 Days 10 Hours ago by: Robert Finch

I figured it out. The compiler now just looks at all the case values to determine if it is possible to use BBS or BBC. There is no need for a special syntax. I put a maximum limit on the size of a jump table of 1,000,000 entries in case

Re: How do we know that H(P,P)==0 is correct? (V4) [ pathological

comp.lang.c

Posted: 22 Days 11 Hours ago by: olcott

*Make sure that you read all of this especially the last line* halt (p, i) { if ( program p halts on input i ) return true ; // p halts else return false ; // p doesn’t halt } Fig. 1. Pseudocode of the Halting Function

Re: How do we know that H(P,P)==0 is correct? (V4) [ pathological

comp.lang.c

Posted: 22 Days 11 Hours ago by: Mr Flibble

You literally have no clue about what you are talking about, whatsoever. This explains everything. /Flibble

Re: naked switches

comp.lang.c

Posted: 22 Days 11 Hours ago by: Bart

The purpose of a switch statement is to enumerate all the values you're interested in. So here, you'd have cases for 1, 2, 4, 8, 16 and so on. Then you'd leave to the compiler to implement that as best it can. If there are too many, us

Re: naked switches

comp.lang.c

Posted: 22 Days 12 Hours ago by: Kaz Kylheku

No, there isn't; switching an integer value to cases labeled by constant integer expressions is all there is. You are probably looking at #include <stdlib.h> const char *sw(int x) { if (x & 1) goto L1; if (x & 2) goto L2;

Re: How do we know that H(P,P)==0 is correct? (V4) [ pathological self-reference(Olcott 2004) ]

comp.lang.c

Posted: 22 Days 12 Hours ago by: olcott

You are the only one that believes that your points have any relevance. That you believe that data movement instructions have anything to do with control flow proves that your points have no relevance.

Re: How do we know that H(P,P)==0 is correct? (V4) [ pathological

comp.lang.c

Posted: 22 Days 12 Hours ago by: Mr Flibble

I continue to note that you repeatedly refuse to address my point regarding how x86 mov instructions can read/write from/to memory mapped I/O rather than RAM so the result of the mov instruction cannot be known a priori. The halting prog

Re: How do we know that H(P,P)==0 is correct? (V4) [ pathological

comp.lang.c

Posted: 22 Days 14 Hours ago by: olcott

You continue to prove to everyone that actually knows these things that you are an ignoramus on this subject. That H correctly decides that all of the standard counter-examples templates never halt eliminates the entire basis of all of

Re: naked switches

comp.lang.c

Posted: 22 Days 14 Hours ago by: Robert Finch

Is there a syntax for one-hot switches, switches that are based around powers of two? I would like the compiler to optimize for usage of the BBS branch-on-bit set instruction if possible.

Re: naked switches

comp.lang.c

Posted: 22 Days 14 Hours ago by: David Brown

That's not true, IME. But avoiding any conceivable clash with otherwise valid code is an intentional feature, hence double underscores are common. Personally, I use a macro : void __attribute__((error("Assume failed"))) assumeFailed(

Re: How do we know that H(P,P)==0 is correct? (V4) [ pathological

comp.lang.c

Posted: 22 Days 15 Hours ago by: Mr Flibble

Except your decider can only handle trivial uninteresting cases: if you wish to make progress on this then prove your decider works with a non-trivial case which includes branching logic predicated on arbitrary program input that is unkno

Re: naked switches

comp.lang.c

Posted: 22 Days 15 Hours ago by: Manfred

Good point. I guess the fact is that this kind of extensions are tightly coupled to the internal mechanics of the compiler, and from this perspective __builtin_unreachable() may be gcc's way of handling this scenario (I trust David

Re: naked switches

comp.lang.c

Posted: 22 Days 15 Hours ago by: Manfred

The compiler may generate the call, but the linker is not going to assemble an executable if the function does not exist. This still holds in C90.

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 22 Days 16 Hours ago by: Michael S

WOW! To my defense: I am programming for too many years. As a result, thinking too much like programmer :( In order to solve this kind of challenges quickly one has to think like mathematician. Also, it helps to be half my age.

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 22 Days 16 Hours ago by: DFS

Good job. FYI: 'triceps' from Japan solved it 00:40:17 after it was posted. https://projecteuler.net/fastestA3

Re: naked switches

comp.lang.c

Posted: 22 Days 17 Hours ago by: Bart

Actually my attention was on the GCC extension. The MSVC version is not too bad, and would be similar to what I'd come up to give an hint about the values of a variable. (I'd use 'assume x in 1..4') However both rather leave open what

Re: naked switches

comp.lang.c

Posted: 22 Days 17 Hours ago by: David Brown

Presumably a compiler that does not implement __builtin_unreachable() as an extension will see it as a call to a function. If the compiler is C90, rather than C99, then it will have to accept the code even though the function is not decl

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 22 Days 17 Hours ago by: Michael S

Do you really want to know? I think, it's more interesting to figure it out by yourself. You can see uncommented solution in my github repo. https://github.com/already5chosen/others/commit/07075aba5bcc3ebbbc45891015f36ac8bd373c71 But I re

Re: How do we know that H(P,P)==0 is correct? (V3) [ global halt

comp.lang.c

Posted: 22 Days 18 Hours ago by: olcott

[Halt Deciding Axiom] When the pure simulation of the machine description ⟨P⟩ of a machine P on its input I never halts we know that P(I) never halts. Because the pure simulation of P(P) never halts this proves that P(P) meets the

Re: How do we know that H(P,P)==0 is correct? (V4) [ pathological self-reference(Olcott 2004) ]

comp.lang.c

Posted: 22 Days 18 Hours ago by: olcott

I have only been trying to specifically define the set that are involved for a few days. comp.theory gets all of my newest material before I put it in my paper. The question: What Boolean value can H return to P representing the corr

Re: naked switches

comp.lang.c

Posted: 22 Days 18 Hours ago by: Manfred

[...] __builtin_unreachable() is a GCC extension (and similarly __assume() for msvc) that is supposed to have no meaning other than for GCC. And that meaning is an instruction for the compiler to consider that range for 'x' impossible

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 22 Days 18 Hours ago by: Kent Dickey

So, what is the "trick"? Does it extend beyond 19 digits (which is what fits in a long long)? Kent

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 22 Days 19 Hours ago by: Michael S

Solved it, finally. 6 seconds of intentionally non-optimized compute + ~30 hours of thinking and trying, 10 of each due to being stubborn. 1 9 9 2 20 29 3

Re: naked switches

comp.lang.c

Posted: 22 Days 19 Hours ago by: Bart

Then there would have been no need for the [] indexing syntax either. You'd just write: GETINDEX(a, i) SETINDEX(a, i, x) instead of a[i] or a[i]=x. Except these need special headers to be dragged in, and everyone would be using

Re: naked switches

comp.lang.c

Posted: 22 Days 20 Hours ago by: David Brown

Yes, to cover all cases you could use: (1llu << ((top) - (bottom)) << 1) It has always struck me as a little odd that (x << 32) is undefined (for 32-bit integers), even for unsigned x. It's fine to be undefined for signed types, but I

Re: naked switches

comp.lang.c

Posted: 22 Days 21 Hours ago by: David Brown

See below. I am not overly interested in such limited compilers. It is silly to worry about the cost of an extra comparison or two in a normal switch for a compiler (or compiler options) that can't even eliminate such extra comparisons

Re: naked switches

comp.lang.c

Posted: 22 Days 22 Hours ago by: Ben Bacarisse

That's undefined when all the bits are wanted. (The left shift of 1llu could be equal to the width.) Maybe you wrote it for a compiler that documents an extension. I usually right shift -1llu by the width minus the number of bits want

Re: naked switches

comp.lang.c

Posted: 22 Days 22 Hours ago by: Bart

As I said, you may want to reserve default: for x==3. This is really ugly and may involve some compilers (eg. mine) adding all those extra checks. But also, how would this work in practice? Case values are usually enums, you'd need t

Re: naked switches

comp.lang.c

Posted: 22 Days 23 Hours ago by: David Brown

Did you try my suggestion of using a newer gcc? You can test it out on <https://godbolt.org>. gcc isn't perfect, and each new version adds new tweaks and optimisations (and new features, and the occasional bug, regression, etc.).

Re: naked switches

comp.lang.c

Posted: 22 Days 23 Hours ago by: David Brown

gcc has a lot more options than that. For example : int floo(int x) { if ((x < 1) || (x > 4)) __builtin_unreachable(); switch (x) { case 1 : return 100; case 2 : return 200; case 3 : return 300;

Re: naked switches

comp.lang.c

Posted: 22 Days 23 Hours ago by: David Brown

Your extension is not commonly used, because it only exists in your tool. People who need to do a lot of bit slicing and don't like masking and shifting (or struct bit-fields) should not have trouble defining: #define BIT(x, top, bottom

Re: naked switches

comp.lang.c

Posted: 23 Days ago by: David Brown

The critical difference is the semantics of the C language - array indexes are not checked automatically in C, the range in a switch /is/ checked because a switch is defined in the language to do nothing if the value does not match any of

Re: How do we know that H(P,P)==0 is correct? (V3) [ independent v

comp.lang.c

Posted: 23 Days 4 Hours ago by: olcott

The behavior of the simulating halt decider cannot possibly have any effect on its halt status decision because it always makes sure to ignore every machine address of its own address range while it is making its halt status decision.

Re: [ OT ] C - Open Standards

comp.lang.c

Posted: 23 Days 5 Hours ago by: Real Troll

It looks like the University link has got a copy that is not password protected: <https://teaching.csse.uwa.edu.au/units/CITS2002/resources/n2176.pdf> I will try keep updating this list so that we have up to date copies when ever pos

Re: How do we know that H(P,P)==0 is correct? (V4) [ pathological self-reference(Olcott 2004) ]

comp.lang.c

Posted: 23 Days 5 Hours ago by: olcott

To eliminate the pathological self-reference(Olcott 2004) from the halting problem such that there is no feedback loop between what the halt decider decides and how the input behaves the simulating halt decider simply watches what the

Re: naked switches

comp.lang.c

Posted: 23 Days 5 Hours ago by: Kaz Kylheku

If the branch instruction is deleted, then it doesn't require branch prediction. Branch prediction isn't free; it requires a cache of information. Any time you put something in it, something else gets bumped. Not emitting the compare an

Re: How do we know that H(P,P)==0 is correct? (V4) [ pathological

comp.lang.c

Posted: 23 Days 5 Hours ago by: olcott

[Halt Deciding Axiom] When the pure simulation of the machine description ⟨P⟩ of a machine P on its input I never halts we know that P(I) never halts. This is a conventional axiom. When the simulating halt decider has detected that

Re: How do we know that H(P,P)==0 is correct? (V4)

comp.lang.c

Posted: 23 Days 7 Hours ago by: olcott

The words have continually gotten clearer in my mind. [Halt Deciding Axiom] When the pure simulation of the machine description ⟨P⟩ of a machine P on its input I never halts we know that P(I) never halts. Every input that never hal

Re: naked switches

comp.lang.c

Posted: 23 Days 9 Hours ago by: Robert Finch

One should not have to write macros for commonly used language elements. In CC64 there is a typenum() keyword that does almost the same thing. It returns a 16-bit hash-code for the type allowing RTTI. Someday I will get around to modify

Re: naked switches

comp.lang.c

Posted: 23 Days 9 Hours ago by: Robert Finch

It was needed to return negative values for error codes from functions. I got tired of having to set all the values manually. I had another case where the values needed to be spaced out. Another case may be power of two values. 1,2,4,8,16,

Re: naked switches

comp.lang.c

Posted: 23 Days 12 Hours ago by: Stefan Ram

This seems to be confusing semantics with implementations. There is no range associated with a switch statement. When writing /implementations/ of switch statement, sometimes, some implementators might believe that for some ca

Re: naked switches

comp.lang.c

Posted: 23 Days 13 Hours ago by: Scott Lurndal

Do the instructions actually affect performance? Unlikely, given modern branch predictors. And vectoring through a bogus entry in a jump table should be avoided.

Re: naked switches

comp.lang.c

Posted: 23 Days 13 Hours ago by: Keith Thompson

That's a normal switch, not a naked one, and the if/goto code is not equivalent to the switch. If x is 42, the switch statement will print "x is in error"; the if/goto code (assuming "goto jumptable[x]" has the obvious meaning) has undef

Re: naked switches

comp.lang.c

Posted: 23 Days 14 Hours ago by: Kaz Kylheku

Elsewhere in the thread, I was not able to coax GCC into eliminating the range test and branch prior to the table switch, even if the default: case of the switch was __builtin_unreachable(). Since two instructions can be removed form the

Re: naked switches

comp.lang.c

Posted: 23 Days 14 Hours ago by: Scott Lurndal

GCC generally generates optimal code sequences for switch statements; from simple sequenced branches for small case counts to jump tables for larger case counts.

Re: naked switches

comp.lang.c

Posted: 23 Days 14 Hours ago by: Kaz Kylheku

A macro can do this: a = BIT(b,10,1); and works everywhere. What you need is a typeof extension to make it work with different integer types while retaining efficiency, otherwise you're looking at making it assume 64 bit, or saddling i

Re: naked switches

comp.lang.c

Posted: 23 Days 14 Hours ago by: Bart

I support such bit operations in my non-C languages, and I'm surprised they are not more widely available because they are so handy. I guess that in C, programmers just have to keep reinventing the same macros for such purposes. For y

Re: naked switches

comp.lang.c

Posted: 23 Days 14 Hours ago by: Kaz Kylheku

GNU C has the feature that labels can be treated as data; they can be stored in variables/objects and used to perform a goto. Thus GNU C has two computed-goto mechanisms: the regular switch which branches to a fixed case label via a comp

Re: naked switches

comp.lang.c

Posted: 23 Days 14 Hours ago by: Robert Finch

I have been using it for simple demos, actually running the compiled code sometime. It has been revamped for several different custom processors, but is still a work in progress. It is a bad idea in terms of allowing program crashes. Bu

Re: naked switches

comp.lang.c

Posted: 23 Days 15 Hours ago by: Bart

I've considered having something like that. I'd have called it 'uswitch'. It was never done because: * The range check wasn't really much of an overhead on x64 (the indexed jump is) * I could never be sure that the switch index would

Re: How do we know that H(P,P)==0 is correct? (V4)

comp.lang.c

Posted: 23 Days 15 Hours ago by: olcott

My earlier statement is corrected below: [Axiom] When the pure simulation of the machine description ⟨P⟩ of a machine P on its input I never halts we know that P(I) never halts. The second half of above criteria is the same criteri

Re: naked switches

comp.lang.c

Posted: 23 Days 16 Hours ago by: David Brown

You wrote that you "have been working on a C/C++ like compiler" - do you mean you have been /using/ such a compiler, or you have been /writing/ such a compiler? As I mentioned earlier, I think a "naked switch" like this is a terrible i

Re: naked switches

comp.lang.c

Posted: 23 Days 17 Hours ago by: Bart

So, this just like array index bounds checking. A bounds check can be omitted if you're sure the index is within range. Except that in C, bounds aren't checked anyway. However most /correct/ programs won't have out-of-bounds indices.

Re: naked switches

comp.lang.c

Posted: 23 Days 18 Hours ago by: Robert Finch

That is basically how it is working. There is still a default statement for unimplemented values between the min and max. The table entry may as well point somewhere useful. There were two goals with this, a) a performance optimization an

Re: How do we know that H(P,P)==0 is correct? (V3) [ global halt decider ]

comp.lang.c

Posted: 23 Days 18 Hours ago by: olcott

H does not execute any machines that never halt until they halt because they never halt. There is nothing improper about them. The global halt decider would abort H(⟨Ĥ⟩, ⟨Ĥ⟩) its input before its input ever reached either

Re: How do we know that H(P,P)==0 is correct? (V3) [ independent v

comp.lang.c

Posted: 23 Days 19 Hours ago by: olcott

A pure simulator has no effect on the behavior of its input thus no effect on its own halt status decision. Only after the simulating halt decider has already made its halt status decision does it switch to modes and abort the simulati

Re: naked switches

comp.lang.c

Posted: 23 Days 21 Hours ago by: Malcolm McLean

Normal switch foo(int x) { switch(x) { case 1: printf("one\n"); break; case 2: printf("two\n"); break; case 3:: printf("three\n"); break; case 4: printf("four\n"): break; default: printf("x is in error\n");

Re: [ OT ] C - Open Standards

comp.lang.c

Posted: 23 Days 21 Hours ago by: Bo Persson

I am not a lawyer :-), but these papers are not official ISO documents, so no commercial license. Especially humorous is n1256. ISO official documents are the C99 official standard, plus three separate corrigenda - TC1, TC2, and TC3.

Re: [ OT ] C - Open Standards

comp.lang.c

Posted: 23 Days 22 Hours ago by: David Brown

My copy is not protected at all. (Unsurprisingly, the sha1sum is different from yours.) I don't remember where I got it, as it was in October 2019 - but I am reasonably confident it was from an official source (such as the wg14 web page

Re: [ OT ] C - Open Standards

comp.lang.c

Posted: 23 Days 23 Hours ago by: Philipp Klaus Krause

I understand that the WG14 / ISO copyright situation can be somewhat complicated (and in the past ISO expressed some dislike about the existance of that WG14 website). On the other hand, what you write would hold for any text, website, et

Re: [ OT ] C - Open Standards

comp.lang.c

Posted: 23 Days 23 Hours ago by: Juha Nieminen

Note that something being directly available for download, even if it's hosted at the IP owners' own servers, doesn't make it somehow automatically legal to download if the documents are under a commercial license. Making something availa

Re: [ OT ] C - Open Standards

comp.lang.c

Posted: 23 Days 23 Hours ago by: Philipp Klaus Krause

Usually, the difference between the latest draft and the official standard is essentially just some added frontmatter pages. C17 was an exception, as AFAIK ISO actually made some changes within the standard document (nothing big, but they

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 24 Days ago by: Michael S

Update: With better code (posted on comp.arch) I managed to brute-force 14 digits. It took almost 4 hours on a single core, far away from timing requirements of the challenge. I expect that 17 digits can be ripped in similar time. May be

Re: naked switches

comp.lang.c

Posted: 24 Days ago by: Keith Thompson

What range checking code are you referring to? Can you give an example in C that demonstrates the change in behavior? How does a default: label affect it?

Re: [ OT ] C - Open Standards

comp.lang.c

Posted: 24 Days ago by: Keith Thompson

My copy, downloaded from http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2176.pdf is password protected. $ sha1sum n2176.pdf 1ec16b0171df2036b9aa07e2abae89aa9a6c2e52 *n2176.pdf (But there are unencrypted copies elsewhere.)

Re: [ OT ] C - Open Standards

comp.lang.c

Posted: 24 Days ago by: David Brown

I have N2176, which is AFAIK the last public draft of C17 (it is titled "C17 ballot").

Re: naked switches

comp.lang.c

Posted: 24 Days ago by: David Brown

Nor have I. I'd suggest that it is a /really/ bad idea, since it changes the semantics of the language. It would be possible to have it as a feature written in a way that screams "this is not a switch statement as you know it", calling

Re: [ OT ] C - Open Standards

comp.lang.c

Posted: 24 Days 1 Hour ago by: David Brown

That's a useful list - thanks. As usual, Microsoft has a somewhat different definition from other people... "Open standard" usually means that the standard is /available/ to anyone who wants it - but not necessarily for free. There ar

Re: [ OT ] C - Open Standards

comp.lang.c

Posted: 24 Days 4 Hours ago by: Keith Thompson

No, you've found links to publicly released drafts of the C standard. N1124 consists of the C99 standard with the first two Technical Corrigenda merged into it. It's not particularly useful given the existence of N1256. N1256 consists

Re: [ OT ] C - Open Standards

comp.lang.c

Posted: 24 Days 5 Hours ago by: Real Troll

OK Thanks for informing about N1570. I have found the official download link so the complete list is as follows: <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2310.pdf> <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf> <ht

Re: How do we know that H(P,P)==0 is correct? (V3)

comp.lang.c

Posted: 24 Days 6 Hours ago by: olcott

I thought this same thing for three days until I figured out that unless the current halt decider aborts its input that no halt decider ever will abort its input.

Re: naked switches

comp.lang.c

Posted: 24 Days 6 Hours ago by: Kaz Kylheku

I've not heard of such an option. Some modern compilers aggressively optimize on the assumption that there is no undefined behavior. Now, I will tell you a fantasy. A conforming C implementation is free to assume that no undefined behav

Re: [ OT ] C - Open Standards

comp.lang.c

Posted: 24 Days 6 Hours ago by: Alf P. Steinbach

N1256 (in your list) is the amalgamated C99 + TC1 + TC2 + TC3 document, very nice. I believe N1570 (not in your list) was the last draft of C11. - Alf

Re: How do we know that H(P,P)==0 is correct? (V3)

comp.lang.c

Posted: 24 Days 6 Hours ago by: olcott

So if the the halt decider is a Universal Turing machine (UTM) that simulates the execution of its inputs as the basis for its halting decision then this is not based on a real Turing machine? Is sounds to me like you are trying to say

Re: How do we know that H(P,P)==0 is correct? (V3)

comp.lang.c

Posted: 24 Days 6 Hours ago by: olcott

We know that every black cat is a cat that is black even if this black cat barks. [Axiom] When the pure simulation of the machine description ⟨P⟩ of a machine P on its input I never halts we know that P(I) never halts. Every input

Re: How do we know that H(P,P)==0 is correct? (V3)

comp.lang.c

Posted: 24 Days 6 Hours ago by: olcott

I am only repeating this a ridiculous number of times because your mental deficiency requires things to be repeated hundreds of times before you notice them for the first time: The behavior of H has no effect on the halt status deci

Re: naked switches

comp.lang.c

Posted: 24 Days 7 Hours ago by: Bart

How much faster does this make it? Because I think that when I tried it on x64, it made no measurable difference. (Maybe the branch predictor dealt with it.) (On x64 also, if there are fewer than about 8 jumptable entries, it was fast

Re: [ OT ] C - Open Standards

comp.lang.c

Posted: 24 Days 7 Hours ago by: Real Troll

[ OT ] C - Open Standards

comp.lang.c

Posted: 24 Days 8 Hours ago by: Real Troll

<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1336.pdf> <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf> <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf> I am not sure if there are any official standards after n

naked switches

comp.lang.c

Posted: 24 Days 8 Hours ago by: Robert Finch

I have been working on a C/C++ like compiler. One feature supported in the compiler is naked switches. A naked switch omits the range checking code that is normally associated with the switch statement. Omitting this code can improve perfo

Re: How do we know that H(P,P)==0 is correct? [ proof ]

comp.lang.c

Posted: 24 Days 9 Hours ago by: olcott

I do have sound deductive inference which is a kind of proof. Mike Terry incorrectly rejected what I have entirely on the basis that it did not fit the pattern of a mathematical proof. Premise(1) (Axiom) When the pure simulation of the

Re: How do we know that H(P,P)==0 is correct?

comp.lang.c

Posted: 24 Days 10 Hours ago by: olcott

With every few posts my words become increasingly more clear and undeniably correct. This only happens because of the feedback that I get for these posts. If you were Edison on the verge of invented the light bulb you would probably c

Re: How do we know that H(P,P)==0 is correct?

comp.lang.c

Posted: 24 Days 11 Hours ago by: Bart

Try a message filter so that you don't see olcott's posts. The posts won't stop, not helped by people engaging with the subject. Why would AI be any more on-topic?

Re: How do we know that H(P,P)==0 is correct? (V3)

comp.lang.c

Posted: 24 Days 12 Hours ago by: olcott

No non-halting input can avoid being analyzed by the global (partial) halt decider. Only programs that are input parameters to the local (partial) halt decider H are analyzed by H. H acts are a pure simulator until the infinite loop b

Re: How do we know that H(P,P)==0 is correct? (V3)

comp.lang.c

Posted: 24 Days 12 Hours ago by: olcott

I knew that and and also knew that Edsger Dijkstra won it four years after he posted a mere letter to the editor to the CACM. https://homepages.cwi.nl/~storm/teaching/reader/Dijkstra68.pdf https://en.wikipedia.org/wiki/Edsger_W._Dijkst

Re: How do we know that H(P,P)==0 is correct? (V3)

comp.lang.c

Posted: 24 Days 13 Hours ago by: Scott Lurndal

There is, of course, the Turing award. But crossposting trolls aren't eligable.

Re: How do we know that H(P,P)==0 is correct? (V3)

comp.lang.c

Posted: 24 Days 13 Hours ago by: olcott

There is no Nobel prize in computing. It turns out that it would have been impossible for me to make my views clear enough to be understood without the feedback that I have received on comp.theory of USENET. They are finally on the ver

Research study of static analysis alarms in C: call for participation

comp.lang.c

Posted: 24 Days 13 Hours ago by: Alexander Serebrenik

Dear C programmers and aficionados Together with colleagues form the University of Nebraska, Lincoln, we are conducting a study of static analysis alarms in C. The study will include completing questionnaires on-line and completing program

Re: How do we know that H(P,P)==0 is correct? (V3)

comp.lang.c

Posted: 24 Days 14 Hours ago by: olcott

P(P) does specify infinitely nested simulation that a global halt decider immediately catches and aborts, thus not allowing P(P) to halt. When the local halt decider is used then H aborts its simulation (P,P) as soon as (P,P) is an inp

Re: How do we know that H(P,P)==0 is correct?

comp.lang.c

Posted: 24 Days 14 Hours ago by: Real Troll

He wants to win a Nobel price in computing! He believes you can recommend him to the Nobel committee for his incessant trolling.

Re: How do we know that H(P,P)==0 is correct? (V3)

comp.lang.c

Posted: 24 Days 15 Hours ago by: olcott

H acts as a pure x86 simulator until its input demonstrates non-halting behavior. It is common knowledge that when-so-ever the pure simulation of the machine description of a machine never halts on its input that this logically entails

Re: How do we know that H(P,P)==0 is correct? (V3)

comp.lang.c

Posted: 24 Days 17 Hours ago by: olcott

H acts as a pure x86 simulator until its input demonstrates non-halting behavior. It is common knowledge that when-so-ever the pure simulation of the machine description of a machine never halts on its input that this logically entails

Re: How do we know that H(P,P)==0 is correct?

comp.lang.c

Posted: 24 Days 19 Hours ago by: Bonita Montero

According to your posting-frequency you're manic. But post only to comp.arch; this is the only appropriate NG. You don't have any C/C++-specific issues and your thoguhts aren't related to AI either.

Re: How do we know that H(P,P)==0 is correct? (V2)

comp.lang.c

Posted: 25 Days 6 Hours ago by: olcott

// Simplified Linz Ĥ (Linz:1990:319) void P(u32 x) { u32 Input_Halts = H(x, x); if (Input_Halts) HERE: goto HERE; } int main() { u32 Input_Halts = H((u32)P, (u32)P); Output("Input_Halts = ", Input_Halts); } When the si

Re: How do we know that H(P,P)==0 is correct? (V2)

comp.lang.c

Posted: 25 Days 7 Hours ago by: olcott

// Simplified Linz Ĥ (Linz:1990:319) void P(u32 x) { u32 Input_Halts = H(x, x); if (Input_Halts) HERE: goto HERE; } int main() { u32 Input_Halts = H((u32)P, (u32)P); Output("Input_Halts = ", Input_Halts); } When the simu

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 25 Days 7 Hours ago by: DFS

Per the problem description F(10^1) = 9, which means 0 isn't included. https://projecteuler.net/problemA3 You may have some insights if you look at the numbers like this: N Substrings * = one-child --- -----------

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 25 Days 9 Hours ago by: Michael S

There was an explanation: the numbers are estimates found by Monte Carlo method. For each number of digits I tested 1E7 randomly distributed points and extrapolated. Later on I repeated the tests with 1E8 point per range and got approxima

Re: How do we know that H(P,P)==0 is correct? (Ben's double-talk

comp.lang.c

Posted: 25 Days 9 Hours ago by: Mr Flibble

Nonsense: mov eax,[ebp+08] the memory at the address [ebp+08] might be mapped to an I/O device so you don't know a priori what value it will have. More nonsense is of course that you have yet to show an example which does involve co

Re: How do we know that H(P,P)==0 is correct? (Ben's double-talk does not work)

comp.lang.c

Posted: 25 Days 11 Hours ago by: olcott

Once people comprehend that my halting criteria eliminates the pathological self-reference(Olcott 2004) of the halting problem proof counter-examples they will understand that the halting problem is not undecidable. Then teams of hundr

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird

comp.lang.c

Posted: 25 Days 11 Hours ago by: James Kuyper

.... I've set up Mozilla Thunderbird to save my messages automatically when I send them. Sometimes, when I'm away from my desktop machine, I will post using Google Groups. If I remember the next time I'm on my desktop machine, I can use M

Re: How do we know that H(P,P)==0 is correct? (Ben's double-talk

comp.lang.c

Posted: 25 Days 11 Hours ago by: Mr Flibble

But this case is trivial and uninteresting: your decider needs to analyse branching logic predicated on arbitrary input to be non-trivial and interesting. You've still got nothing of value to show. /Flibble

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird

comp.lang.c

Posted: 25 Days 12 Hours ago by: Real Troll

You don't need anything elaborate. When you post anything to the newsgroups, a copy also goes into the Sent folder by default. You can configure how this handled instead of everything saved to Sent folder but it is a different topic f

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird

comp.lang.c

Posted: 25 Days 12 Hours ago by: DFS

How are you saving your own posts? I have various python code to pull posts off newsservers, if you're interested.

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird

comp.lang.c

Posted: 25 Days 13 Hours ago by: James Kuyper

.... I've been participating in Usenet newsgroups since the early 90's, and I've tried save copies of all of my posts. Sometimes I forgot, and sometimes I lost saved archives, but I still have 10's of thousands of messages saved. At one t

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 25 Days 14 Hours ago by: Kent Dickey

I was just posting code I wrote before your posts. I did not see any "proofs", there was a post with some numbers, with no explanation of where they came from or why we should believe it. I wrote some code to get some idea if pruning wo

Re: How do we know that H(P,P)==0 is correct? (correct halt deciding criterion measure)

comp.lang.c

Posted: 25 Days 15 Hours ago by: olcott

When the simulation of a computation halts without ever being aborted this is exactly the same as the set of halting problem computations that halt. Every element of the set of halting problem computations that never halt map to an el

Re: How do we know that H(P,P)==0 is correct? (correct halt deciding criterion measure)

comp.lang.c

Posted: 25 Days 16 Hours ago by: olcott

void Infinite_Loop() { HERE: goto HERE; } int main() { u32 Input_Would_Halt2 = H((u32)Infinite_Loop, (u32)Infinite_Loop); Output("Input_Would_Halt2 = ", Input_Would_Halt2); } You keep dodging this. When Infinite_Loop() is force

Re: How do we know that H(P,P)==0 is correct? (Ben's double-talk does not work)

comp.lang.c

Posted: 25 Days 16 Hours ago by: olcott

The criterion measure of every Turing Machine Description ⟨P⟩ of Turing machine P that would never halt on its input I <is> the exact same set as the set of simulations (P,I) that must be aborted to prevent their infinite simulatio

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 25 Days 21 Hours ago by: Michael S

Those are still variations of the theme that I outlined in the post from Jul 4, 2021, 1:21:16 PM As proven in the post from Jul 5, 2021, 12:44:48 PM, as far as original 1=19 digits challenge is concerned, it's a dead end. In order to tac

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird

comp.lang.c

Posted: 26 Days 1 Hour ago by: David Brown

In particular, there is a vast difference between "deleted" and "made temporarily inaccessible". Google disabled access to c.l.c and various other groups via their groups interface. This was, as we all know, a completely idiotic "throw

Re: How do we know that H(P,P)==0 is correct? (Ben's double-talk does not work)

comp.lang.c

Posted: 26 Days 3 Hours ago by: olcott

On the basis that we know that every UTM(P,I) never halts defines the exact same set of computations that must be aborted by a simulating halt decider which defines the exact same set of computations P(I) that never halt we can know th

Re: Could H correctly decide that P never halts? [ already agreed ]

comp.lang.c

Posted: 26 Days 4 Hours ago by: olcott

H(P,P) == 0 is axiomatically correct thus impossibly incorrect. If all X's are Y and all Y's are Z then all X's are Z even if you really really hate it and even if it really really seems to form a direct contradiction. Once you under

Re: How do we know that H(P,P)==0 is correct? (correct halt deciding criterion measure)

comp.lang.c

Posted: 26 Days 5 Hours ago by: olcott

The simulating halt decider has two crucial phases: (1) It is only a simulator until its input proves that it will never halt unless aborted. At this point we have perfect certainty that the simulating halt decider is correct. (2) Aft

Re: How do we know that H(P,P)==0 is correct? (correct halt deciding

comp.lang.c

Posted: 26 Days 5 Hours ago by: olcott

The simulating halt decider has two crucial phases: (1) It is only a simulator until its input proves that it will never halt unless aborted. At this point we have perfect certainty that the simulating halt decider is correct. (2) Aft

Re: How do we know that H(P,P)==0 is correct? (correct halt deciding criterion measure)

comp.lang.c

Posted: 26 Days 7 Hours ago by: olcott

Because every element of the set of computations that never halt unless their simulation is aborted maps to every element of the set of non-halting computations we know that it is an equivalent criterion measure that defines the same s

Re: Could H correctly decide that P never halts? [ already agreed ]

comp.lang.c

Posted: 26 Days 7 Hours ago by: olcott

That the prefix to infinitely nested simulation halts because its suffix is aborted cannot reasonably be construed as a computation that halts in the same way that that following computation can be construed as a computation that halts

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 26 Days 7 Hours ago by: Kent Dickey

I wrote 2 programs to try to calculate this. First, there's no nead to atoi/sprintf or whatever. Just do operations on an array of bytes, and form the numbers with num = (num * 10) + dig as needed. I'll attach my initial code to show t

Re: Could H correctly decide that P never halts? [ Richard's

comp.lang.c

Posted: 26 Days 8 Hours ago by: olcott

This is a very excellent summation of the difference between a computation that halts and a computation that had its simulation aborted. When you do say something that is clearly brilliant (to be honest) I must point it out.

Re: How do we know that H(P,P)==0 is correct? (correct halt deciding

comp.lang.c

Posted: 26 Days 8 Hours ago by: olcott

In computability theory, the halting problem is the problem of determining, from a description of an arbitrary computer program and an input, whether the program will finish running, or continue to run forever. https://en.wikipedia.org

Re: Could H correctly decide that P never halts?

comp.lang.c

Posted: 26 Days 9 Hours ago by: olcott

void P(u32 x) { u32 Input_Halts = H(x, x); if (Input_Halts) HERE: goto HERE; } int main() { P((u32)P); } If you weren't dumber than a box of rocks you would understand that the above computation never halts unless it is

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird

comp.lang.c

Posted: 26 Days 9 Hours ago by: Chris M. Thomasson

I need to check one of my links... Can you get it to work? https://groups.google.com/g/comp.lang.c/c/a53VxN8cwkY/m/XKl1-0a8DAAJ This must mean that comp.lang.c is back up online wrt GG! Nice!

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird

comp.lang.c

Posted: 26 Days 9 Hours ago by: Chris M. Thomasson

That link works, and goes to content! Thanks Keith.

Re: How do we know that H(P,P)==0 is correct? (Ben's double-talk does not work)

comp.lang.c

Posted: 26 Days 10 Hours ago by: olcott

Try and get your double-talk around this: void P(u32 x) { u32 Input_Halts = H(x, x); if (Input_Halts) HERE: goto HERE; } int main() { P((u32)P); } Because the above computation must be aborted at some point or it never h

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird and eternal-september)

comp.lang.c

Posted: 26 Days 11 Hours ago by: Keith Thompson

Re: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 26 Days 12 Hours ago by: Chris M. Thomasson

GG was nice to be able to provide a link that anybody could go to and read content, even if they never heard about usenet before. Now, all of those links are dead in the water! That sucks. Grrrr. ;^(

Re: How do we know that H(P,P)==0 is correct?

comp.lang.c

Posted: 26 Days 12 Hours ago by: olcott

This really really seems to be beyond your capacity to understand: H never ever gets to the point in its own execution where it aborts the simulation of its input until AFTER its input has already proven that it will never halt unless

Re: Does anybody have any idea that why the output is not the sorted

comp.lang.c

Posted: 26 Days 13 Hours ago by: Real Troll

You are mixing C++ syntax with C and this might be the problem for you. I suggest start with this simple code that works in GCC & VS:

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird

comp.lang.c

Posted: 26 Days 14 Hours ago by: olcott

I provided an email address that I never use.

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird

comp.lang.c

Posted: 26 Days 15 Hours ago by: Real Troll

If you don't want to give your personal details to that chap running that crap then you can use aioe: <news://news.aioe.org/comp.lang.c> <news://news.aioe.org/comp.lang.c++> <http://news.aioe.org/> You don't need to give any valid e

Re: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 26 Days 15 Hours ago by: olcott

This archive seems to have full text from the earliest years of USENET. https://www.usenetarchives.com/ comp.lang.c goes back to 1986 https://www.usenetarchives.com/threads.php?id=comp.lang.c&y=0&r=0&p=1 comp.lang.java goes back to 1995

Re: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 26 Days 15 Hours ago by: Sam

--=_monster.email-scan.com-39691-1625503952-0001 Content-Type: text/plain; format=flowed; delsp=yes; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 7bit James Harris writes: There are nntp clients for Android. I

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird and eternal-september)

comp.lang.c

Posted: 26 Days 15 Hours ago by: olcott

The archive is distributed many places. Personally I use Giganews and their archive goes back to 2004: $4.99 per month. All of my very old messages still show up in Google groups. https://cacm.acm.org/news/248041-21-million-of-the-old

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird

comp.lang.c

Posted: 26 Days 15 Hours ago by: Alf P. Steinbach

As I recall Google has deleted the GG comp.lang.c archives. Half a year ago? A year? And ditto for comp.lang.java? Not sure. At the time, in a Facebook posting I compared that to the Nazi's book burning. For, it's about the same idea:

How do we know that H(P,P)==0 is correct?

comp.lang.c

Posted: 26 Days 15 Hours ago by: olcott

The x86utm operating system was created so that the halting problem could be examined concretely in the high level language of C. When examining the halting problem this way every detail can be explicitly specified. UTM tape elements are

Re: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 26 Days 16 Hours ago by: James Harris

I use Thunderbird and Eternal September when I'm at home. But an internet service like Google Groups is useful for when travelling.

Re: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 26 Days 16 Hours ago by: James Harris

Where did you hear that?

Re: Could H correctly decide that P never halts? [ Why can H ignore its own behavior? ](my thanks to Richard)

comp.lang.c

Posted: 26 Days 17 Hours ago by: olcott

The entire OS is one big sandbox. Yes. There are 26,419 execution steps that are not shown. None of these steps have any effect on the behavior of the input. So far no one has fully understood the 33 steps that I have posted in any of

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 26 Days 18 Hours ago by: Ben Bacarisse

Interesting. Thanks.

Re: Could H correctly decide that P never halts? [ Why can H ignore its own behavior? ](my thanks to Richard)

comp.lang.c

Posted: 26 Days 18 Hours ago by: olcott

Every H only acts as a pure x86 emulator until some P has demonstrated that it will never halt unless it is aborted. Once it is fully understood that any computation that never halts unless its simulation is aborted is the correct non-

Re: comp.lang.c blocked on Google Groups Switch to free (Thunderbird

comp.lang.c

Posted: 26 Days 18 Hours ago by: olcott

Switch to free (Thunderbird and eternal-september) Free newsgroup host https://www.eternal-september.org/ Free newsgroup client https://www.thunderbird.net/en-US/

Re: Could H correctly decide that P never halts? [ halting criteria ]

comp.lang.c

Posted: 26 Days 18 Hours ago by: olcott

Every H only acts as a pure x86 emulator until some P has demonstrated that it will never halt unless it is aborted. Once it is fully understood that any computation that never halts unless its simulation is aborted is the correct non-

Re: Could H correctly decide that P never halts? [ Why can H ignore

comp.lang.c

Posted: 26 Days 18 Hours ago by: olcott

Software emulators have all of the details of subordinate emulations as their own data. H makes sure to ignore every address of itself and all operating system functions because neither OS functions nor itself have any effect on the be

Re: Could H correctly decide that P never halts? [ Why can H ignore

comp.lang.c

Posted: 26 Days 19 Hours ago by: olcott

Every H only acts as a pure x86 emulator until some P has demonstrated that it will never halt unless it is aborted. Once it is fully understood that any computation that never halts unless its simulation is aborted is the correct non

Re: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 26 Days 20 Hours ago by: Malcolm McLean

The world has gone crazy. Apparently we were blocked because someone was posting material about the epidemic.

Re: comp.lang.c blocked on Google Groups

comp.lang.c

Posted: 26 Days 21 Hours ago by: James Harris

I just checked again on the offchance and GG is allowing access to comp.lang.c again. .... Indeed. Someone set up https://usenetarchives.com/ which seems to be copying Usenet articles from somewhere but it is doing so very slowl

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 26 Days 22 Hours ago by: Michael S

I did something that I should have do from the beginning - estimate of result by Monte Carlo method (with 10M random samples per range). Estimate = 3.1e15, majority of it in 18-digit and 16-digit ranges. 3.1e15 * 1 nsec = 35 days. It mea

Re: Does anybody have any idea that why the output is not the sorted

comp.lang.c

Posted: 27 Days 2 Hours ago by: David Brown

Second hint - always enable plenty of warnings on your compiler! A good compiler can give lots of help (such as telling you about unused variables) if you let it.

Re: Could H correctly decide that P never halts? [ Why can H ignore

comp.lang.c

Posted: 27 Days 3 Hours ago by: olcott

You must not know assembly x86 language at all. // Simplified Linz Ĥ (Linz:1990:319) void P(u32 x) { u32 Input_Halts = H(x, x); // call H 2nd level of simulation if (Input_Halts) HERE: goto HERE; } int main() { u32 In

Re: Could H correctly decide that P never halts? [ already agreed ]

comp.lang.c

Posted: 27 Days 5 Hours ago by: olcott

It can be easily verified that if no H ever aborts any P that P(P) will never halt. If any H must abort any P then this H does correctly decide that this P does not halt.

Re: Could H correctly decide that P never halts? [ already agreed ]

comp.lang.c

Posted: 27 Days 5 Hours ago by: olcott

Every computation that would never halt unless its simulation is aborted is equally not a halting computation. There is no exception to this rule in the same way and for the same reason that the numeric integer 5 is always numerically

Re: Could H correctly decide that P never halts? [ already agreed ]

comp.lang.c

Posted: 27 Days 6 Hours ago by: olcott

void Infinite_Loop() { HERE: goto HERE; } int main() { u32 Input_Would_Halt2 = H((u32)Infinite_Loop, (u32)Infinite_Loop); Output("Input_Would_Halt2 = ", Input_Would_Halt2); } Then Infinite_Loop() is a halting computation on the

Re: Could H correctly decide that P never halts? [ Why can H ignore

comp.lang.c

Posted: 27 Days 6 Hours ago by: olcott

// Simplified Linz Ĥ (Linz:1990:319) void P(u32 x) { u32 Input_Halts = H(x, x); if (Input_Halts) HERE: goto HERE; } int main() { u32 Input_Halts = H((u32)P, (u32)P); Output("Input_Halts = ", Input_Halts); } I have prov

Re: Does anybody have any idea that why the output is not the sorted

comp.lang.c

Posted: 27 Days 10 Hours ago by: Manfred

[...] Definitely odd layout, which might be source of confusion for the OP in the first place. [...] The intention seems to be a basic O(N^2) algorithm (with mistakes, which I won't do a rewrite for because this sounds like a homework

Re: Does anybody have any idea that why the output is not the sorted

comp.lang.c

Posted: 27 Days 11 Hours ago by: Vir Campestris

Best thing for you to do is to run it step-by-step through a debugger, then you'll be able to see for yourself. FYI C++ has both sorted collections (such as std::set) and built in sort algorithms; the fact that you aren't using them su

Re: Could H correctly decide that P never halts? [ Why can H ignore

comp.lang.c

Posted: 27 Days 12 Hours ago by: olcott

Sure everyone knows that an x86 emulator can be anything from a vanilla milkshake machine to a dump truck. What I mean by x86 emulator is software that executes x86 machine language as if this software virtual machine was an actual x8

Re: Could H correctly decide that P never halts? [ already agreed ]

comp.lang.c

Posted: 27 Days 15 Hours ago by: olcott

Yes and by this same reasoning we know that when the simulation of an infinite loop is aborted this proves that the infinite loop that only jumps to its own machine address is indeed a halting computation. void Infinite_Loop() { HER

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 27 Days 15 Hours ago by: Michael S

I measured it. Without this optimization the programs runs ~1.5 times slower. So, optimization is not insignificant. But I admit that at minimal performance cost it can be expressed in more comprehensible way.

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 27 Days 16 Hours ago by: Michael S

This home desktop is from 2012 and even then was considered inexpensive, while not the cheapest possible. Naturally, PCs I use to do a "real work" like FPGA development are significantly faster. Comfortable web browsing, may be? I mea

Re: Could H correctly decide that P never halts? [ prerequisites to understanding me]

comp.lang.c

Posted: 27 Days 17 Hours ago by: olcott

On 5/11/2021 11:10 AM, Ben Bacarisse wrote: Every computation that halts on its own without having to be aborted by the halt decider is a halting computation. Every computation that never halts unless the halt decider aborted it is a

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 27 Days 17 Hours ago by: Bart

It's not that slow if my 2010 AMD-whatever is only 2.5 times as slow as an Intel i5. Or is your main machine even faster? (My machine can build all of my language projects from scratch (some 100 modules and 150Kloc) in about half a se

Re: Could H correctly decide that P never halts? [ Why can H ignore its own behavior? ](my thanks to Richard)

comp.lang.c

Posted: 27 Days 17 Hours ago by: olcott

No instance of any H has any effect on any P until some P proves that it will never halt unless aborted. This has always been able to be directly verified by the assembly language execution trace of P relative to its assembly language

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 27 Days 19 Hours ago by: Ben Bacarisse

No, me neither. And I'm not usually drawn to problems that use an arbitrary base (my code had a base argument in case there was something interesting about other bases) so I've not given it much thought. But I admit to be being intrigu

Re: Does anybody have any idea that why the output is not the sorted array and how should edit the code and why the output is trash

comp.lang.c

Posted: 27 Days 19 Hours ago by: Ben Bacarisse

Wrong group. You want comp.lang.c++ but apparently Google Groups has trouble with the ++. If you plan to use Usenet a lot, get a news reader and a news server account (there are some free ones out there). Why, in C++, would you not u

Re: Does anybody have any idea that why the output is not the sorted

comp.lang.c

Posted: 27 Days 21 Hours ago by: WeAllWant ToBeHappy

Some 0's added to pad out to 12 elements When j=size-1, p+j+1 is off the end of the array

Does anybody have any idea that why the output is not the sorted

comp.lang.c

Posted: 27 Days 21 Hours ago by: hamid daniali

#include <iostream> using namespace std; void swap(int *,int *); void sort (int [],int ); int main() { const int size; int a[size]={1,2,96,21,17,3,9,14}; sort(a,size); for(int i=0;i<size;i++) cout<<a[i]<<" ";} void sort (int a[],int size)

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 27 Days 21 Hours ago by: Michael S

I think that given ~10 GB of RAM I know how to solve it in approximately 300 core*months, which is borderline doable. The idea is that, for the hardest case of 19 digits there are 32609741 9-digit strings with no children, 145677482 10-

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 27 Days 23 Hours ago by: Michael S

Your ability to enjoy slow PCs does not surprise me any more. If your program uses strings then only 20 times is a little disappointing. Because I wrote it for myself, as a one time exercise and put in virtually no comments. Still, ev

Re: Difference between C89 and other C standards

comp.lang.c

Posted: 28 Days 3 Hours ago by: Keith Thompson

C89 and C90 are the same language, described by different editions of the standard (ANSI and ISO, respectively). The documents differ by the insertion of some additional sections, so C89 section 3 is C90 section 6. C99 and C11 are newer

Re: Could H correctly decide that P never halts? [ prerequisites to

comp.lang.c

Posted: 28 Days 4 Hours ago by: olcott

Not really not at all. P has already proved that it will never halt unless H aborts it. Once P has done this then this proves that the not halting decision of H is necessarily correct.

Re: Difference between C89 and other C standards

comp.lang.c

Posted: 28 Days 5 Hours ago by: James Kuyper

C90 differed from C89 almost exclusively by the addition of three sections at the beginning that were required by ISO. As a result, all section numbers in C89 were increased by 3 in C90. Each version of the C standard after C89 contains

Re: Could H correctly decide that P never halts? [ prerequisites to understanding me]

comp.lang.c

Posted: 28 Days 5 Hours ago by: olcott

No the problem is that your attention span is very very short so I cannot possibly expect you to be able to follow more than one single point at a time. Do you understand that H cannot possibly have any effect what-so-ever on the behav

Re: Difference between C89 and other C standards

comp.lang.c

Posted: 28 Days 6 Hours ago by: Richard Damon

Wikipedia has an article on C99, the next version of the langague which has a section on the changes: https://en.wikipedia.org/wiki/C99 Not sure why you want to know what this sort of detail about C89 (or C90 as it is more commonly calle

Difference between C89 and other C standards

comp.lang.c

Posted: 28 Days 7 Hours ago by: Rayshawn Levy

I'm trying to figure out the differences between C89 and the other C standards. What are the valid types, macros, directives, syntax, etc. in C89 (I can't seem to find the answer to this anywhere) compared to the other standards and there s

Re: Could H correctly decide that P never halts? [ already agreed ]

comp.lang.c

Posted: 28 Days 7 Hours ago by: olcott

You already agreed that this adaptation of the halt status criteria is correct: On 5/11/2021 11:10 AM, Ben Bacarisse wrote:

Re: Could H correctly decide that P never halts? [ prerequisites to understanding me]

comp.lang.c

Posted: 28 Days 7 Hours ago by: olcott

I went too fast for you. I will break it down to simpler steps. No H has any effect on any computation what-so-ever until some H determines that some P would never halt unless aborted.

Re: Could H correctly decide that P never halts? [ prerequisites to understanding me]

comp.lang.c

Posted: 28 Days 8 Hours ago by: olcott

As long as every H only acts as a pure x86 emulator until some P exhibits behavior that would never halt unless aborted by some H then entirely on the basis of the meaning of these words when this H (that sees the never halting behavio

Re: Could H correctly decide that P never halts? [ Why can H ignore

comp.lang.c

Posted: 28 Days 9 Hours ago by: olcott

The same input that you are calling "trivial" is the same input that all the conventional halting problem proofs call "impossible". // Simplified Linz Ĥ (Linz:1990:319) void P(u32 x) { u32 Input_Halts = H(x, x); if (Input_Halts)

Re: Could H correctly decide that P never halts? [ Why can H ignore

comp.lang.c

Posted: 28 Days 9 Hours ago by: Mr Flibble

But you can only decide it will never halt for uninteresting trivial cases: until you decider can handle an arbitrary algorithm predicated on arbitrary program input you've got nothing. /Flibble

Re: Could H correctly decide that P never halts? [ Why can H ignore

comp.lang.c

Posted: 28 Days 9 Hours ago by: olcott

No H ever aborts any P until after some P have proved beyond all possible doubt that it will never halt unless aborted. Until some P does prove this every H only acts as an x86 emulator and nothing more.

Re: Could H correctly decide that P never halts?

comp.lang.c

Posted: 28 Days 10 Hours ago by: olcott

Because a simulating halt decider must always abort the simulation of every input that never halts its halt deciding criteria must be adapted. Does the input halt on its input? must become Does the input halt without having its simulati

Re: Could H correctly decide that P never halts? [ incorrect question ]

comp.lang.c

Posted: 28 Days 11 Hours ago by: olcott

I have to both know exactly what the conventional term of the art of undecidable means and be able to show exactly how the philosophical foundation of such a concept is incoherent. In the mean time knowing the terminology can be side-s

Re: Could H correctly decide that P never halts? [ Why can H ignore

comp.lang.c

Posted: 28 Days 11 Hours ago by: olcott

If a simulating halt decider H ALWAYS merely simulates its input until it detects that its input matches an infinite execution behavior pattern then H can always ignore its own behavior when it is analyzing the halt status of its input

Re: Could H correctly decide that P never halts?

comp.lang.c

Posted: 28 Days 12 Hours ago by: Ben Bacarisse

Please consider trimming newsgroups. I've replied (about PO stuff) in comp.theory where the main points are topical. It might be topical, but C without big nums is not very useful for this sort of thing! This function won't always t

Re: Could H correctly decide that P never halts? [ Why can H ignore its own behavior? ]

comp.lang.c

Posted: 28 Days 13 Hours ago by: olcott

This may be simply too difficult for you to understand. When a simulating halt decider only simulates its input until it detects that its input exhibits non-halting behavior then We can know that this simulating halt decider has no eff

Re: Could H correctly decide that P never halts?

comp.lang.c

Posted: 28 Days 13 Hours ago by: olcott

On 5/11/2021 11:10 AM, Ben Bacarisse wrote: Because a simulating halt decider must always abort the simulation of every input that never halts its halt deciding criteria must be adapted. Does the input halt on its input? must become Do

Re: Could H correctly decide that P never halts?

comp.lang.c

Posted: 28 Days 13 Hours ago by: olcott

The Goldbach conjecture is not undecidable in the conventional sense in that we know that both {Yes and No} are the wrong answer. The Goldbach conjecture is undecided and not undecidable.

Re: Could H correctly decide that P never halts?

comp.lang.c

Posted: 28 Days 14 Hours ago by: Siri Cruise

Number theory conjectures can be written as Turing Machines to produce a counterexample that halt on a counterexample or do not halt if the conjecture is true. Assume the halting problem is decidable, then the conjecture can be decide

Re: Could H correctly decide that P never halts?

comp.lang.c

Posted: 28 Days 14 Hours ago by: Bonita Montero

You don't don't discuss any C/C++-specific issues. comp.theory is the only NG that fits. Stop posting in comp.lang.c/c++. You're a off-topic-terrorist.

Re: Could H correctly decide that P never halts?

comp.lang.c

Posted: 28 Days 14 Hours ago by: olcott

It is a specific software engineering problem in the C programming language. The C source code is provided.

Re: Could H correctly decide that P never halts?

comp.lang.c

Posted: 28 Days 14 Hours ago by: Bonita Montero

It's related to programming in general. So you shouldn't post in groups related to specific languages.

Re: Could H correctly decide that P never halts?

comp.lang.c

Posted: 28 Days 15 Hours ago by: olcott

It is 100% totally related to software engineering in C. The first 8 pages of my paper are only about software engineering in C. Halting problem undecidability and infinitely nested simulation https://www.researchgate.net/publication/35

Re: Could H correctly decide that P never halts?

comp.lang.c

Posted: 28 Days 15 Hours ago by: olcott

Superficially it may seem that way until you realize (as you have already realized) that the halt criteria must be adapted for a simulating halt decider. Because a simulating halt decider must always abort the simulation of every inpu

Re: Could H correctly decide that P never halts?

comp.lang.c

Posted: 28 Days 15 Hours ago by: Bonita Montero

You are off-topic in comp.lang.c/c++. Nothing what you say is especially related to C or C++. Stop posting here.

Re: Could H correctly decide that P never halts?

comp.lang.c

Posted: 28 Days 15 Hours ago by: olcott

void P(u32 x) { u32 Input_Halts = H(x, x); if (Input_Halts) HERE: goto HERE; } int main() { u32 Input_Halts = H((u32)P, (u32)P); Output("Input_Halts = ", Input_Halts); } When the called is calling H in infinitely nested

Re: Could H correctly decide that P never halts?

comp.lang.c

Posted: 28 Days 16 Hours ago by: olcott

There is a huge gap in the reasoning of the halting problem proofs. All of the conventional halting problem proofs simply assume that H must return the correct halt status of P(P) to P. None of these proofs considered the possibility that

Could H correctly decide that P never halts?

comp.lang.c

Posted: 28 Days 16 Hours ago by: olcott

*Halting problem undecidability and infinitely nested simulation* When the halt decider bases its halt status decision simulating its input then the conventional halting problem proof undecidability counter-example templates can be correc

Re: Why don't I simply submit my paper to an academic journal for

comp.lang.c

Posted: 29 Days 8 Hours ago by: olcott

Until the behavior of the input demonstrates an infinite execution behavior pattern the behavior of H is a pure x86 emulator, thus cannot possibly have any effect on the behavior of its input.

Re: Why don't I simply submit my paper to an academic journal for

comp.lang.c

Posted: 29 Days 8 Hours ago by: olcott

It seems to me that any expert software engineer that knows C and the x86 language can very easily verify that my H / P are in the correct halting problem relation and H does correctly decide that P does not halt. Halting problem undec

Re: Why don't I simply submit my paper to an academic journal for review?[ incorrect questions ]

comp.lang.c

Posted: 29 Days 9 Hours ago by: olcott

Yes and I used poetic license because I knew that what I really had was equivalent to two Turing machines yet did not know that the concept of "equivalent to Turing machines" was known by anyone besides myself. All that I have ever pre

Re: Why don't I simply submit my paper to an academic journal for

comp.lang.c

Posted: 29 Days 12 Hours ago by: olcott

So then we are back to my own pathological self-reference(olcott 2004). That the code that I claimed was RASP equivalent rather than an actual Turing machine is the poetic license that I used when I understood that it was equivalent t

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 29 Days 13 Hours ago by: Ben Bacarisse

But neither stepping digits or running a counter can possibly get you to 10**19 in reasonable time. I estimate that, on laptop, just running a loop from 1 to 10**19 will take more than 130 years.

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 29 Days 14 Hours ago by: Ben Bacarisse

In the "arithmetic" versions, there are no strings. Yes, there are various opportunities for short-circuiting many cases. I wonder if that's enough to make 10^19 tractable. Also, problems like this are supposed to be satisfying, and

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 29 Days 14 Hours ago by: Kaz Kylheku

The obvious thing here is to encode custom divisibility tests for d = [1,19]. For certain divisors, we can test divisibility on the base 10 representation without converting to integer. It's a waste of time to convert "1235" into 1235 to

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 29 Days 14 Hours ago by: Bart

Well, it's fast (about 65 seconds on my machine, perhaps 20 times as fast as my program). But I can't say it's that easy to follow! It seems to rely on the fact that consecutive numbers are being tested, so can optimise blocks all hav

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 29 Days 14 Hours ago by: DFS

F(10^7) 7.2s here, with pypy3. F(10^8) 86.2S (old system i5-750@2.67GHz) The pypy people have done a remarkable job in speeding up python code. The pypy interpreter itself looks to have been written in python https://downloads.

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 29 Days 15 Hours ago by: Michael S

Just to prove to myself that brute force is dead end Here is rather clever brute force. It does 1e9 in 26 sec on my aging home PC (i5-3450). #include <stdint.h> #include <stdbool.h> #include <stdlib.h> #include <stdio.h> static bool is

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 29 Days 15 Hours ago by: Bart

I created my own script version, which got ported to C (see my recent post), but I also converted it to this Python: ---------------------------------- def onechild(n): s=str(n) slen=len(s) count = (n%slen)==0 for

Re: Why don't I simply submit my paper to an academic journal for review?

comp.lang.c

Posted: 29 Days 16 Hours ago by: olcott

The strongest "proof" that I am incorrect is simply that people really really don't believe that I am correct, can you see that this form of "rebuttal" is utterly baseless? If you think that anyone had a stronger rebuttal then please p

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 29 Days 16 Hours ago by: Bart

For F(10^7) I got 9.4 seconds with gcc-O3 with the C version below that uses atoi equivalents. I seem to remember that my machine is quite a bit slower than yours. Use of u64 rather than int doesn't affect the results. I started on a v

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 29 Days 16 Hours ago by: DFS

Incredible site - thanks for the link. -Wall -Wextra is pretty strict. It even warned of unused 'argc' from main(). I saw Bart tried pypy and got good results. I tried pypy3 on the below and got a 13.8x speed increase over p

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 29 Days 16 Hours ago by: DFS

That's very good. "Each problem has been designed according to a 'one-minute rule', which means that although it may take several hours to design a successful algorithm with more difficult problems, an efficient implementation will

Re: Why don't I simply submit my paper to an academic journal for review?

comp.lang.c

Posted: 29 Days 16 Hours ago by: olcott

25 reviews per day by half a dozen reasonably competent reviewers could not point to a single technical error in any aspect of the ideas referenced in this paper at any time in the last six months. Halting problem undecidability and in

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 29 Days 17 Hours ago by: Michael S

No, I didn't. Have more interesting things to do. Besides, brute force is so obvious dead end...

Re: Why don't I simply submit my paper to an academic journal for review?

comp.lang.c

Posted: 29 Days 17 Hours ago by: olcott

This is the model of computation that forms a bridge between the x86 language and Turing machines. https://en.wikipedia.org/wiki/Random-access_stored-program_machine I even figured out how a machine with relative addressing such as x64

Re: Why don't I simply submit my paper to an academic journal for

comp.lang.c

Posted: 29 Days 17 Hours ago by: olcott

void P(u32 x) { u32 Input_Halts = H(x, x); if (Input_Halts) HERE: goto HERE; } int main() { u32 Input_Halts = H((u32)P, (u32)P); Output("Input_Halts = ", Input_Halts); } H determines that P is calling it in infinitely n

Re: Why don't I simply submit my paper to an academic journal for review?

comp.lang.c

Posted: 29 Days 17 Hours ago by: olcott

Since the question is whether or not H must abort the simulation of P on the basis of the behavior of P it is utterly incorrect for H to examine its own behavior. Maybe if I tell you this 150 more times it will start to sink in and yo

Re: Why don't I simply submit my paper to an academic journal for review?[ incorrect questions ]

comp.lang.c

Posted: 29 Days 17 Hours ago by: olcott

In other words you are claiming that the (TM X/Input I) pairs that have no correct yes/no return value from X have no specific term-of-the-art. // Simplified Linz Ĥ (Linz:1990:319) void P(u32 x) { u32 Input_Halts = H(x, x); if (

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 29 Days 17 Hours ago by: Ben Bacarisse

I didn't know that. As you say, a different algorithm is called for. (My best naive version gets F(10^9) in 4m21.489s and F(10^7) in 2.177s.)

Re: Why don't I simply submit my paper to an academic journal for review?[ incorrect questions ]

comp.lang.c

Posted: 29 Days 18 Hours ago by: olcott

No that is not even close. Read my paper (linked below) to see what I mean: No that is not even close. Read my paper (linked below) to see what I mean: I constantly update this paper to make my works more clear. I just rewrote the abs

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 29 Days 18 Hours ago by: Ben Bacarisse

No, it's a plain integer / and % version. Have you got one that does something clever with the divisions?

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 29 Days 20 Hours ago by: Michael S

Read posts of Ben Bacarisse. atai() or similar functions are not needed at all. If you are a bit smart about algorithms then 64-bit arithmetic is not needed either. In fact, even 32-bit arithmetic is not necessary. Suppose, you have a sub

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 29 Days 21 Hours ago by: Bart

It wouldn't get very far using 'int' types either, which limits it to F(10^9). It would need to use uint64_t (with changes to atoi etc) to manage F(10^19). I guess that's why that limit was chosen. Python of course could go well beyo

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 29 Days 21 Hours ago by: Michael S

If you understand that it can't be done by brute force then why are you trying to do just that? Supposedly, the speed of your code could be improved by factor of 10 or, with a bit of algorithmic smarts, even by factor of 100. It's still d

Re: Losing my mind: results change with/without printf() statements

comp.lang.c

Posted: 29 Days 22 Hours ago by: Michael S

Does it include replacement of division by reciprocal multiplication?

601 recent articles found.

rocksolid light 0.7.0
clearneti2ptor