Questions tagged [specifier]
59 questions
135
votes
14 answers
Should I use an exception specifier in C++?
In C++, you can specify that a function may or may not throw an exception by using an exception specifier. For example:
void foo() throw(); // guaranteed not to throw an exception
void bar() throw(int); // may throw an exception of type int
void…

1800 INFORMATION
- 131,367
- 29
- 160
- 239
10
votes
4 answers
'static volatile' vs. 'static' vs. 'volatile' in C
What's the difference between using the variable specifiers static volatile combined? Or using one alone; like static or volatile in microcontroller programming?

R1S8K
- 365
- 1
- 3
- 18
10
votes
2 answers
C++11 standard ref for allowed type definitions in type specifier uses?
In C++11 a type specifier includes class specifiers and enum specifiers. (aka class definitions and enumeration definitions)
According to the grammar/syntax - type specifiers can appear in several places in the language, but not in all those places…

Andrew Tomazos
- 66,139
- 40
- 186
- 319
9
votes
3 answers
Swiftui specify double format
Text("Värde \(Double(calc2, specifier: "%.2f").rounded())")
//ERROR
I am converting a Slider value that uses a double type, but i cant format specify it?
I get an error and xcode tells me to use signaling(?). I've tried putting it into an Int as…

oscar
- 101
- 1
- 1
- 7
8
votes
4 answers
Should we provide a destructor with no-throw specifier?
namespace QuantLib {
//! Base error class
class Error : public std::exception {
public:
/*! The explicit use of this constructor is not advised.
Use the QL_FAIL macro instead.
*/
Error(const…

q0987
- 34,938
- 69
- 242
- 387
6
votes
3 answers
Error: C++ requires a type specifier for all declarations
I'm new to C++ and I've been reading this book. I read a few chapters and I thought of my own idea. I tried compiling the code below and I got the following error:
||=== Build: Debug in Password (compiler: GNU GCC Compiler) ===|
…

Gigabillion
- 63
- 1
- 1
- 5
5
votes
4 answers
C++ For what types can the parameter type name be the same as the parameter name with a type specifier?
This question is going to take a bit of explination, sorry. I am fixing an oversight in doxygen parsing some C++ code and I have come across an unusual corner case that doxygen doesn't account for. I have a fix but I want to make it more general so…

John Scipione
- 2,360
- 4
- 25
- 28
5
votes
1 answer
Why does printf specifier format %n not work?
This is my code:
#include
int main(void) {
int n;
fprintf(stdout, "Hello%n World\n", &n);
fprintf(stdout, "n: %d\n", n);
return 0;
}
This is my output:
Hellon: 0
Why does the fprintf format specifier "%n" not work?…

Alessandro Avolio
- 95
- 8
4
votes
1 answer
error C3646: 'closure' : unknown override specifier
I got the following error:
error C3646: 'closure' : unknown override specifier
The code:
void BaseOperator::mousebutton_cb(EventObject* sender, EventArgs* calldata, void* closure)
{
xd3D::Operation::Operator::BaseOperator* operator =…

Spectral
- 717
- 2
- 12
- 28
4
votes
4 answers
How would I write my own new format specifier in C?
Is it possible to write a new format specifier in C? For example, let's say, %g is a format specifier which prints the ip address in A.B.C.D format from the unsigned integer equivalent.
int ip_addr = Some integer
printf("ip address = %g",…

Abhishek Sagar
- 1,189
- 4
- 20
- 44
4
votes
4 answers
Reading character with scanf()
This code is for game of craps.
#include
#include
#include
#include
int roll_dice(void);
bool play_game(void);
int main()
{
int i, ch,win = 0,lose = 0;
bool flag;
srand((unsigned)time(NULL));
…

haccks
- 104,019
- 25
- 176
- 264
4
votes
2 answers
Python: Want to use a string as a slice specifier
Suppose I have a variable S with the string "1:3" (or for that matter, "1", or "1:" or ":3") and I want to use that as a slice specifier on list L. You cannot simply do L[S] since the required args for a slice are "int:int".
Now, I current have some…

staggart
- 267
- 1
- 6
- 15
3
votes
4 answers
Question regarding C argument promotions
Alright actually I've study about how to use looping to make my code more efficient so that I could use a particular block of code that should be repeated without typing it over and over again, and after attempted to use what I've learn so far to…

caramel1995
- 2,968
- 10
- 44
- 57
3
votes
3 answers
Missing Type Specifier - Int Assumed in C++
These second line of these is throwing this error, but I'm not sure why.
std::vector weapons(100);
weapons[3] = "Rusty dagger";
--
Here's my entire file:
//global variables
#ifndef _GLOBAL_
#define _GLOBAL_
#include
#include…

pighead10
- 4,155
- 10
- 34
- 52
3
votes
1 answer
Open android intent using a specific application(package name known)
My problem is that I have an intent such as this one.
Intent intent = new Intent(MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH);
intent.putExtra(MediaStore.EXTRA_MEDIA_FOCUS, MediaStore.Audio.Artists.ENTRY_CONTENT_TYPE); …

KISHORE_ZE
- 1,466
- 3
- 16
- 26