Wikipedia:Reference desk/Archives/Computing/2021 October 4
Computing desk | ||
---|---|---|
< October 3 | << Sep | October | Nov >> | October 5 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
October 4
[edit]enum in C standard
[edit]What's the earliest C standard to include the enum type? 68.161.175.73 (talk) 00:19, 4 October 2021 (UTC)
- enum is in the earliest C standard, the one created in 1989 by ANSI. (By the way, enum is not a type, it's a keyword used to declare what the standard calls "enumerated types" and their associated "enumeration constants". If you declare
enum {A, B, C} x; enum {P, Q} y;
, thenx
andy
have two different enumerated types.)
- Since the standard's purpose was to "codify existing practice", enum must have existed in some versions of C before the standard appeared, but I can't say which was the first to have it. --184.144.99.72 (talk) 07:47, 4 October 2021 (UTC)
- Huh, thanks, TIL. Didn't realize it was that early. 68.161.175.73 (talk) 08:41, 4 October 2021 (UTC)
- It wasn't in the original K&R, so I'd guess that one of the compiler manufacturers (IBM? DEC?) nabbed a good idea from Pascal which had it earlier. A lot of the pre-PC manufacturers offered enhancements to their various compilers, some of which were subsequently adopted into the standard forms. Martin of Sheffield (talk) 10:41, 4 October 2021 (UTC)
- The C++ Programming Language — Reference Manual, which calls C++ "C extended with classes, ...", does not mention enumeration types. Although it has no date, I believe it is from late 1984. So, presumably, they had then not yet been introduced in C. The ANSI committee that defined the standard was set up in 1983, and they took five years to define it. The minutes of the committee, if they have been preserved, may identify their origin. --Lambiam 11:17, 4 October 2021 (UTC)
- Schildt 1990, p. 798 states: "The ANSI standard adds the following keywords: const, enum, signed, void, volatile". Schildt 1990, p. 198: "An extension to the C language added by the ANSI C standard is enumeration". Microsoft Corporation 1990, p. 90 mentions enum as "similar to the enumerated type in QuickPascal". Blaha 1995, p. 32 has "Enumerations are a feature of ANSI C and C++". It therefore looks as though ANSI X3.159-1989 "Programming Language C" is the point at which enum was introduced.
- Blaha, Stephen (1995). C++ for professional programming with PC and UNIX applications (1. print. ed.). London: Internat. Thomson Computer Press. ISBN 978-1-85032-801-8.
- Microsoft Corporation (1990). C for Yourself (2.5 ed.). Microsoft Corporation.
- Schildt, Herbert (1990). C, the complete reference (2nd ed.). Berkeley, Calif., U.S.A: Osborne McGraw-Hill. ISBN 978-0-07-881538-6.
- Martin of Sheffield (talk) 13:15, 4 October 2021 (UTC)
- Schildt is notoriously unreliable, but that's not to say that he wasn't right this time. --184.144.99.72 (talk) 20:15, 4 October 2021 (UTC)
- I'd forgotten until now that the Rationale for the ANSI C standard is available online, and it does in fact say here that the keyword
enum
had been "added". However, it also says here that "The Committee has formalized enhancements of proven value which have become part of the various dialects of C." So this suggests that, as I said before, they took it from some existing version of C, but it does not say which one. --184.144.99.72 (talk) 20:36, 4 October 2021 (UTC)- "Schildt is notoriously unreliable" – you are arguing from the specific to the general here. The example you link to is C.D.W.Feather's critique of Schildt's "The Annotated Annotated C Standard" not a general case at all. It does perhaps warn one to look for supporting statementsBlaha and Microsoft provide. Martin of Sheffield (talk) 21:33, 4 October 2021 (UTC)
- Making so many errors in one book is, I suggest, sufficient to establish unreliability. Anyway, not here to debate. --184.144.99.72 (talk) 21:02, 5 October 2021 (UTC)
- "Schildt is notoriously unreliable" – you are arguing from the specific to the general here. The example you link to is C.D.W.Feather's critique of Schildt's "The Annotated Annotated C Standard" not a general case at all. It does perhaps warn one to look for supporting statementsBlaha and Microsoft provide. Martin of Sheffield (talk) 21:33, 4 October 2021 (UTC)
- I'd forgotten until now that the Rationale for the ANSI C standard is available online, and it does in fact say here that the keyword
- Schildt is notoriously unreliable, but that's not to say that he wasn't right this time. --184.144.99.72 (talk) 20:15, 4 October 2021 (UTC)
- Schildt 1990, p. 798 states: "The ANSI standard adds the following keywords: const, enum, signed, void, volatile". Schildt 1990, p. 198: "An extension to the C language added by the ANSI C standard is enumeration". Microsoft Corporation 1990, p. 90 mentions enum as "similar to the enumerated type in QuickPascal". Blaha 1995, p. 32 has "Enumerations are a feature of ANSI C and C++". It therefore looks as though ANSI X3.159-1989 "Programming Language C" is the point at which enum was introduced.
- The C++ Programming Language — Reference Manual, which calls C++ "C extended with classes, ...", does not mention enumeration types. Although it has no date, I believe it is from late 1984. So, presumably, they had then not yet been introduced in C. The ANSI committee that defined the standard was set up in 1983, and they took five years to define it. The minutes of the committee, if they have been preserved, may identify their origin. --Lambiam 11:17, 4 October 2021 (UTC)
- It wasn't in the original K&R, so I'd guess that one of the compiler manufacturers (IBM? DEC?) nabbed a good idea from Pascal which had it earlier. A lot of the pre-PC manufacturers offered enhancements to their various compilers, some of which were subsequently adopted into the standard forms. Martin of Sheffield (talk) 10:41, 4 October 2021 (UTC)
- Huh, thanks, TIL. Didn't realize it was that early. 68.161.175.73 (talk) 08:41, 4 October 2021 (UTC)
SMTP 554
[edit]I tried to report a spam to the Microsoft Abuse team and to Digitalocean abuse. I was using Outlook as my mail client, and Windows 10. I got an error message listing all of the addresses, and, for each them, reported 554 6.6.0 Error sending message for delivery.
I have looked up SMTP 554, and that says that the message is too big for the system. The message is not as long as other spam reports I have sent, or other emails that I have sent. Is there a reference that will more specifically tell what a 554 6.6.0 is? Is there something in an Internet header that might cause a 554? Robert McClenon (talk) 05:08, 4 October 2021 (UTC)
- See List of SMTP server return codes. 554 is "Transaction has failed" (See RFC4468), but 554 can have enhanced status codes attached, see RFC3463. There you will see (§3.7) "Message Content or Message Media Status". Within that X.6.0 is "Other or undefined media error" which translates to "Something about the content of a message caused it to be considered undeliverable and the problem cannot be well expressed with any of the other provided detail codes". Basically, the server is rejecting the message because of its content. This is probably not length (that would be a 5.3.4) but may indicate that there is something really nasty in the message (well it is spam) that MS and DA don't want on their server. Martin of Sheffield (talk) 07:32, 4 October 2021 (UTC)
- Thank you, User:Martin of Sheffield. Your parenthetical comment, "well it is spam", is well taken. I must have incorporated something from the ad itself, because what I was trying to send was mainly the Internet header, which is just a lot of ASCII gibberish, parts of which can be looked in whois. So there was probably some nasty character string or something. Oh well. Robert McClenon (talk) 21:47, 4 October 2021 (UTC)
PATH and PING Question
[edit]I would like to be able to issue the PING command within the command prompt (what was formerly a DOS box and is still sometimes called one) under Windows 10. The PING command isn't recognized. I think that I was previously able to do a Ping under Windows 10, although it might have only been Windows 7. I recall that enabling that was done by including a library in the PATH command, and that could in turn be included in a batch file that was run when Windows started up. So my first question is whether there still is a startup batch file, and, if so, where is it? My second question is whether there is still a library that enables the Ping command to be performed as an external command. Robert McClenon (talk) 21:43, 4 October 2021 (UTC)
- So far as I know ping is a standard part of Windows 7 and 10 - I just checked both. In each case (both 64-bit Windows) it is
C:\Windows\System32\PING.EXE
, with that directory normally on the system path. Check that directory, and your path. Mitch Ames (talk) 11:47, 5 October 2021 (UTC)- Thank you, User:Mitch Ames. Where is the startup batch file, sometimes called STARTUP.BAT, that sets the PATH command and is executed on startup, located? Robert McClenon (talk) 16:29, 5 October 2021 (UTC)
- So far as I'm aware there is no startup.bat, and hasn't been since the days of DOS and autoexec.bat. The PATH is set by the operating system, along with other environment variables, from a value in the registry. From the start menu search for "environment variables" (details depend on the OS version, or search the internet for more specific instructions) and check the system variables.
- However - first just run
path
from a cmd prompt and it will show you the current PATH. If \windows\system32 is not on the path, you'll probably have much bigger problems. Did you check your current path already? Is \windows\system32 on it? Did you check that directory to see if ping.exe exists? Mitch Ames (talk) 00:17, 6 October 2021 (UTC)
- Thank you, User:Mitch Ames. Where is the startup batch file, sometimes called STARTUP.BAT, that sets the PATH command and is executed on startup, located? Robert McClenon (talk) 16:29, 5 October 2021 (UTC)
Troubleshooting the USB Receptacle
[edit]I am having repeated errors trying to read from a set of flash drives that I recently bought, and am wondering how to troubleshoot whether the problem is with the devices themselves, or with the USB slot on my desktop computer. Obviously I hope that the problem is just with the flash drives. Is there a way to troubleshoot the port on the computer, perhaps using a USB cord to a phone and driving data between the two machines? I can also try to read and write the flash drives on a laptop computer, so part of my question is whether there is a known failure mode where a failing port causes something to become flaky with the flash drive. Also, is there a test than can be run on a flash drive that is more intensive than the Windows Properties Tools command? And what is the relative probability of a USB receptacle developing a problem as opposed to a flash drive having a problem? Robert McClenon (talk) 21:56, 4 October 2021 (UTC)
- It's possible you been scammed. There are plenty of flash drives out there that Windows will happily write 10 gigs to but not read it back because the actual capacity is like 2 gigs. See https://www.raymond.cc/blog/test-and-detect-fake-or-counterfeit-usb-flash-drives-bought-from-ebay-with-h2testw/ The easiest way to check if it's a port problem is try plugging the flash drives into a different device. 41.165.67.114 (talk) 06:26, 5 October 2021 (UTC)
- USBs do become worn with use and unreliable. The front panel outlets on my desktop will only now work with brand-new cables. Sticks are very intermittent. System is about 7 years old. You could always try fitting a new USB card into the back of the machine and using that. I upgraded my USB to 3.0 this way some time ago and I think only paid around £10 for a card from PCWorld. Martin of Sheffield (talk) 07:14, 5 October 2021 (UTC)
- Agreed. However, "a set of flash drives that I recently bought" implies they are not worn out. 41.165.67.114 (talk) 07:55, 5 October 2021 (UTC)
- Clarification: USB connectors. The socket on the machine might be a problem, in which case you could get all the new sticks you wanted, they would still give you "repeated errors". The OP states "part of my question is whether there is a known failure mode where a failing port causes something to become flaky with the flash drive" to which the answer is yes, hence my concentration on the socket rather than the plug. Martin of Sheffield (talk) 08:20, 5 October 2021 (UTC)
- Follow-up question for User:Martin of Sheffield - If there is a problem with the socket on the front of my tower machine, can a technician replace the socket without any impact on the hard drive in the machine? Robert McClenon (talk) 16:37, 5 October 2021 (UTC)
- @Robert McClenon: From my knowledge replacing the USB outlet won't impact the hard drive. There may be some cables they'll have to disconnect that connect the USB outlet to the hard drive but it shouldn't really cause any major impact on it. ― Blaze The WolfTalkBlaze Wolf#6545 16:40, 5 October 2021 (UTC)
- Follow-up question for User:Martin of Sheffield - If there is a problem with the socket on the front of my tower machine, can a technician replace the socket without any impact on the hard drive in the machine? Robert McClenon (talk) 16:37, 5 October 2021 (UTC)
- Clarification: USB connectors. The socket on the machine might be a problem, in which case you could get all the new sticks you wanted, they would still give you "repeated errors". The OP states "part of my question is whether there is a known failure mode where a failing port causes something to become flaky with the flash drive" to which the answer is yes, hence my concentration on the socket rather than the plug. Martin of Sheffield (talk) 08:20, 5 October 2021 (UTC)
- Agreed. However, "a set of flash drives that I recently bought" implies they are not worn out. 41.165.67.114 (talk) 07:55, 5 October 2021 (UTC)
- Just as Blaze The Wolf says. It's pretty straight forward to do yourself, the other alternative is to put a new USB card into the expansion slot. Typically that will give you four new USB 3.0 sockets for £10-£20. I got one a couple of years back from Amazon, £12.85 shown here. Martin of Sheffield (talk) 19:31, 5 October 2021 (UTC)
- That's the nice thing about computers. Most of the time wires are only clipped in and are not soldered on (although sometimes they are as those wires are not meant to be removed). ― Blaze The WolfTalkBlaze Wolf#6545 19:34, 5 October 2021 (UTC)
- Just as Blaze The Wolf says. It's pretty straight forward to do yourself, the other alternative is to put a new USB card into the expansion slot. Typically that will give you four new USB 3.0 sockets for £10-£20. I got one a couple of years back from Amazon, £12.85 shown here. Martin of Sheffield (talk) 19:31, 5 October 2021 (UTC)