|
There exists at least one C/C++ program which can be written in one line.
I try to avoid putting any pre-processor directives in my C/C++ files -- an include can be specified at the command line for the compilers I use.
I somewhat agree that the language of C/C++ and its pre-processor are separate languages. One can create any number of alternative pre-processor languages -- K&R's is just one.
Maybe you haven't used Oracle's PRO*C or RDB's version for embedding SQL in C/C++ programs.
One thing I want in a pre-processor is the ability to tell it which directives to process and which to leave for later. I have had to jump through hoops to get things to work the way I want.
And I do like lots of SPACEs which are not "required":
# include <vcl.h>
# include "Mainwindow.h"
|
|
|
|
|
PIEBALDconsult wrote: an include can be specified at the command line for the compilers I use
Interesting! I know how to specify an include path but not a file.
PIEBALDconsult wrote: Maybe you haven't used Oracle's PRO*C or RDB's version for embedding SQL in C/C++ programs. No, never! I've been fortunate in that respect The closest I got was using SQLITE
Mircea
|
|
|
|
|
Mircea Neacsu wrote: but not a file
If I recall correctly, with VAX/DEC/Compaq/HP C the switch is /FirstInclude .
I don't have an installation of Microsoft's C/C++ compiler on this system -- nor Borland's C/C++ or GCC -- but I can try to have a look when I get home.
MingW:
An example from Implanting Common Code in Unrelated Classes[^]
"C:\mingw\bin\cpp" -P -C -include "c:\batfiles\ImplantWarning.h" D__NAME_SPACE__=%3 -D__CLASS_NAME__=%4 -w "%1" "%2"
I'm sure I have it for Microsoft's C/C++ compiler (cl.exe) as well. I have probably referred to it in the past.
Oh!:
Re: c program - C / C++ / MFC Discussion Boards[^]
F:\Projects>cl.exe /nologo /FIstdio.h /DSEMI=; nosem.c
|
|
|
|
|
Nice! You live, you learn.
Mircea
|
|
|
|
|
Agreed, but I'm not sure all tokenizers would be happy with the lack of a space, which in this case might be considered as significant as a punctuation character. But then, I suppose when you see something starting with "#include", the next character really should not be part of that token. Especially when it's a reserved character such as < or ", so I suppose the situation is easy enough to detect and allow.
|
|
|
|
|
It wouldn't be part of the token in most tokenizer implementations.
"include" would be a preproc keyword.**
** or identifier if the tokenizer doesn't distinguish between idents and keywords as is often the case.
Most of the time, whitespace is hidden during tokenization before the parser gets to it so the parser wouldn't really care if there was no whitespace unless the developer put in extra effort for it to care.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
dandy72 wrote: Agreed, but I'm not sure all tokenizers would be happy with the lack of a space,
A C++ compiler is not compliant if it requires a space before the '<'
The spec defines a preprocessor id as a '#' followed by a 'token'
A token (section 2.1) must be one of the following
- Identifier
- keyword
- literal
- operator
- other separators
"...collectively 'white space')...are ignored except as they serve to separate tokens"
So in the context of this the following is valid
#include<io.h>
But the following would not be since the token in that case would be 'includeio'
#includeio.h
Keep in mind of course that this doesn't make 'includeio' valid. But just that as far as tokenization goes that is what would happen.
|
|
|
|
|
That was my assumption, but I didn't want to look it up because lazy.
Thanks.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
jschell wrote: A C++ compiler is not compliant if it requires a space before the '<'
There ya go. End of discussion. Thanks for pointing that out.
|
|
|
|
|
A sampling of compilers at Compiler Explorer were happy without spaces. Have to admit that it just looks wrong to me. But then I'm an old fogey ...
"A little song, a little dance, a little seltzer down your pants"
Chuckles the clown
|
|
|
|
|
k5054 wrote: Compiler Explorer
Of course that had to exist. So, this is the source code equivalent to VirusTotal...
Very neat. Thanks for that link.
|
|
|
|
|
While I'm trying to find a way to train my cards game this link to a nice book came up:
http://www.incompleteideas.net/book/RLbook2020.pdf
Does someone here has experience with Reinforcement Learning and is it helpful for a card game AI like Bridge or Schafkopf? In those card games there are two teams and it seems more complicate than RL for BlackJack or Hearts.
|
|
|
|
|
We just updated an industry leading tool from version 2019 to 2022 (the latest).
One new feature is a REST Web API, which is the main reason we're updating.
It works through Swagger in the browser, but calling the API from code proved to be more of a challenge.
Apparently, it authenticates using Kerberos or NTLM
I wouldn't even think that was an option in 2022 (or even at all, for a Web API).
|
|
|
|
|
Sander Rossel wrote: Apparently, it authenticates using Kerberos or NTLM
I wouldn't even think that was an option in 2022 (or even at all, for a Web API).
Yeah, that is _interesting_.
I mean you're still passing a token to get authenticated, I'm guessing?
Do you (on the cient side) have to do something special or is it all done on the server side?
Is there a special process to generate a special Kerberos token on the client side?
I don't know how that works. It sounds confusing.
|
|
|
|
|
Apparently, it works as follows:
var handler = new HttpClientHandler
{
Credentials = new NetworkCredential("username", "password", "domain")
};
var client = new HttpClient(handler);
You can do this using DI and use the IHttpClientFactory to create your clients.
You're not sending tokens, it's more like Basic Authentication.
|
|
|
|
|
I hope your experience with Swagger is better than mine!
IIRC, the real challenge was dealing with intermittent (>50%) timeout errors likely caused by the huge amount of data I was requesting. (caused by the inability to get proper summarized results in the outdated odata service provider)
I emailed the vendor to ask for help and report the high occurrence of timeouts and got nowhere. That project was ultimately scrapped due to lack of support from the vendor/customer.
"Go forth into the source" - Neal Morse
"Hope is contagious"
|
|
|
|
|
That's not really Swagger's fault.
Swagger is just (generated) documentation of a web API with the ability to test the API.
If the API sucks, so will Swagger.
If anything, Swagger showed you the API sucked and that you didn't need to invest more time in it.
The only "bad experience" I've had with Swagger was it breaking when doing some non-standard API development (like having a single endpoint for all functionality, don't ask...).
I can't really expect Swagger to handle such weird edge cases.
|
|
|
|
|
Adam: I want a perfect soulmate
God: That will cost you an arm and a leg
Adam: ...
Adam: What can I get for a rib?
*hides*
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
"Barbeque Sauce?"
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
Beware the ides of April, it may tax thy soul.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
(Caesar): The Ides of March are come.
(Soothsayer): Ay, Caesar; but not gone.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
People are losing the spirit of the Ides of March.
It's not about stabbing.
It's about coming together, to stab in groups.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
The Senators needed to get their point across.
|
|
|
|
|
I've just been reading a bit about the differences, and see some mentions of Display Port being more capable in multi-monitor applications. My last PC build included a video card (ASUS TUF RTX 3060Ti) includes both types of connector, as do my two monitors, but I assembled it all using HDMI simply because that was the type of cable I had on hand. I know that a lot of you use two or more monitors; which do you prefer? If I switch to Display Port will I see enough improvement, if any, to justify the fairly cheap cost of new cables?
Will Rogers never met me.
|
|
|
|