Re: [sqlite] "struct Mem" conflicts with namespaces/classes having the same name

2017-04-09 Thread Daniel Anderson
I see no problems with C++.

Mem is only foward declared, you can redefined it to whatever you want. as
long as you do not redefined it for sqlite.c you should be good.

in sqlite.h it's declared:

struct Mem;

so in your code if you do:

struct Mem { int a;int b;} then your definition will be used for your code.

as sqlite is only using pointer, and has his own definition, I do not see
the problem.

it breaks the ODR, but as I previously said it's used/allocated internally
 by sqlite which should never see your definition.

can you explain in more detail what is happening ?

can you make a small reproduceable  sample ?

also are you mixing C++ & C, or is your code all in c ?

Daniel

2017-04-09 15:49 GMT-04:00 dip :

> sqlite3.c is C file. C does not support namespaces.
> Even though another project files are .cpp, sqlite3.c is still compiled as
> C language source.
> Therefore, no ability to use "using namespace" in sqlite3.c.
> Also, "using namespace" does not actually put functions in the source in
> namespace. It just helps it find another functions without specifying
> namespace name.
>
> Sent with [ProtonMail](https://protonmail.com) Secure Email.
>
>  Original Message 
> Subject: Re: [sqlite] "struct Mem" conflicts with namespaces/classes
> having the same name
> Local Time: April 9, 2017 10:23 PM
> UTC Time: April 9, 2017 7:23 PM
> From: d3c...@gmail.com
> To: SQLite mailing list 
>
> On Sun, Apr 9, 2017 at 12:20 PM, Richard Damon 
> wrote:
>
> > On 4/9/17 1:49 PM, Olivier Mascia wrote:
> >
> >> Le 9 avr. 2017 à 18:49, dip  a écrit :
> >>>
> >>> I downloaded latest SQLite Amalgamation (v 3.18.0) to embed it in my
> >>> project.
> >>> After that I got a lot of errors while compiling (compiler is Microsoft
> >>> Visual Studio 2017).
> >>> Errors were caused by the following line in sqlite3.h:
> >>>
> >>> typedef struct Mem sqlite3_value;
> >>>
> >>> The reason is that I have the namespace with the same name.
> >>> So I have a suggestion to rename "struct Mem" to something else (add
> >>> prefix to it) because "Mem" is a very common name like "input" or
> "data" or
> >>> "buffer" and there may be classes or namespaces having the same name.
> >>>
> >> The way to overcome this completely in large programmings using many
> >> libraries is to include sqlite3.h within a namespace. Not something that
> >> SQLite code must do itself: that's best handled at the user project
> level.
> >>
> >> The problem with this is that if the header file is put in a namespace
> in
> > the user code, then the source file that defines these functions needs to
> > also be changed to put the files in that same namespace, or the things
> > being defined won't be found.
> >
> > think that's what 'use namespace' is for
>
> > --
> > Richard Damon
> >
> >
> > ___
> > sqlite-users mailing list
> > sqlite-users@mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
Daniel
*L'action accède à la perfection quand, bien que vivant, vous êtes déjà
mort*
*Bunan*
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] "struct Mem" conflicts with namespaces/classes having the same name

2017-04-09 Thread Bob Friesenhahn

On Sun, 9 Apr 2017, dip wrote:


What happens with mangling then? extern "C" functions inside a namespace just 
do not get mangled? If so, sounds like a workaround.


Yes, extern "C" functions don't get mangled.

Bob
--
Bob Friesenhahn
bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,http://www.GraphicsMagick.org/
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] "struct Mem" conflicts with namespaces/classes having the same name

2017-04-09 Thread Keith Medcalf
You mean like this:

https://www.sqlite.org/src/info/19dd753f9e50fee2


-- 
˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı

> -Original Message-
> From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> On Behalf Of dip
> Sent: Sunday, 9 April, 2017 14:48
> To: SQLite mailing list 
> Subject: Re: [sqlite] "struct Mem" conflicts with namespaces/classes
> having the same name
> 
> What happens with mangling then? extern "C" functions inside a namespace
> just do not get mangled? If so, sounds like a workaround.
> 
> But it will be really better if SQLite adds prefix to it's "Mem" and other
> internals.
> 
> Sent with [ProtonMail](https://protonmail.com) Secure Email.
> 
>  Original Message 
> Subject: Re: [sqlite] "struct Mem" conflicts with namespaces/classes
> having the same name
> Local Time: April 9, 2017 11:19 PM
> UTC Time: April 9, 2017 8:19 PM
> From: bfrie...@simple.dallas.tx.us
> To: SQLite mailing list 
> 
> On Sun, 9 Apr 2017, dip wrote:
> 
> > sqlite3.c is C file. C does not support namespaces.
> > Even though another project files are .cpp, sqlite3.c is still compiled
> as C language source.
> > Therefore, no ability to use "using namespace" in sqlite3.c.
> > Also, "using namespace" does not actually put functions in the source in
> namespace. It just helps it find another functions without specifying
> namespace name.
> 
> Nevertheless, it is possible to include the C header file within a C++
> namespace and then import the functions you need into the namespace
> used by your own C++ code or refer to them specifically within the
> namespace you created. I have done this successfully across many C++
> compilers for 19 years already.
> 
> It would definitely be best if sqlite does not pollute the name space
> with names not starting from a common prefix.
> 
> Bob
> --
> Bob Friesenhahn
> bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
> GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] "struct Mem" conflicts with namespaces/classes having the same name

2017-04-09 Thread dip
What happens with mangling then? extern "C" functions inside a namespace just 
do not get mangled? If so, sounds like a workaround.

But it will be really better if SQLite adds prefix to it's "Mem" and other 
internals.

Sent with [ProtonMail](https://protonmail.com) Secure Email.

 Original Message 
Subject: Re: [sqlite] "struct Mem" conflicts with namespaces/classes having the 
same name
Local Time: April 9, 2017 11:19 PM
UTC Time: April 9, 2017 8:19 PM
From: bfrie...@simple.dallas.tx.us
To: SQLite mailing list 

On Sun, 9 Apr 2017, dip wrote:

> sqlite3.c is C file. C does not support namespaces.
> Even though another project files are .cpp, sqlite3.c is still compiled as C 
> language source.
> Therefore, no ability to use "using namespace" in sqlite3.c.
> Also, "using namespace" does not actually put functions in the source in 
> namespace. It just helps it find another functions without specifying 
> namespace name.

Nevertheless, it is possible to include the C header file within a C++
namespace and then import the functions you need into the namespace
used by your own C++ code or refer to them specifically within the
namespace you created. I have done this successfully across many C++
compilers for 19 years already.

It would definitely be best if sqlite does not pollute the name space
with names not starting from a common prefix.

Bob
--
Bob Friesenhahn
bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] "struct Mem" conflicts with namespaces/classes having the same name

2017-04-09 Thread Bob Friesenhahn

On Sun, 9 Apr 2017, dip wrote:


sqlite3.c is C file. C does not support namespaces.
Even though another project files are .cpp, sqlite3.c is still compiled as C 
language source.
Therefore, no ability to use "using namespace" in sqlite3.c.
Also, "using namespace" does not actually put functions in the source in 
namespace. It just helps it find another functions without specifying namespace name.


Nevertheless, it is possible to include the C header file within a C++ 
namespace and then import the functions you need into the namespace 
used by your own C++ code or refer to them specifically within the 
namespace you created.  I have done this successfully across many C++ 
compilers for 19 years already.


It would definitely be best if sqlite does not pollute the name space 
with names not starting from a common prefix.


Bob
--
Bob Friesenhahn
bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,http://www.GraphicsMagick.org/
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] "struct Mem" conflicts with namespaces/classes having the same name

2017-04-09 Thread dip
sqlite3.c is C file. C does not support namespaces.
Even though another project files are .cpp, sqlite3.c is still compiled as C 
language source.
Therefore, no ability to use "using namespace" in sqlite3.c.
Also, "using namespace" does not actually put functions in the source in 
namespace. It just helps it find another functions without specifying namespace 
name.

Sent with [ProtonMail](https://protonmail.com) Secure Email.

 Original Message 
Subject: Re: [sqlite] "struct Mem" conflicts with namespaces/classes having the 
same name
Local Time: April 9, 2017 10:23 PM
UTC Time: April 9, 2017 7:23 PM
From: d3c...@gmail.com
To: SQLite mailing list 

On Sun, Apr 9, 2017 at 12:20 PM, Richard Damon 
wrote:

> On 4/9/17 1:49 PM, Olivier Mascia wrote:
>
>> Le 9 avr. 2017 à 18:49, dip  a écrit :
>>>
>>> I downloaded latest SQLite Amalgamation (v 3.18.0) to embed it in my
>>> project.
>>> After that I got a lot of errors while compiling (compiler is Microsoft
>>> Visual Studio 2017).
>>> Errors were caused by the following line in sqlite3.h:
>>>
>>> typedef struct Mem sqlite3_value;
>>>
>>> The reason is that I have the namespace with the same name.
>>> So I have a suggestion to rename "struct Mem" to something else (add
>>> prefix to it) because "Mem" is a very common name like "input" or "data" or
>>> "buffer" and there may be classes or namespaces having the same name.
>>>
>> The way to overcome this completely in large programmings using many
>> libraries is to include sqlite3.h within a namespace. Not something that
>> SQLite code must do itself: that's best handled at the user project level.
>>
>> The problem with this is that if the header file is put in a namespace in
> the user code, then the source file that defines these functions needs to
> also be changed to put the files in that same namespace, or the things
> being defined won't be found.
>
> think that's what 'use namespace' is for

> --
> Richard Damon
>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] "struct Mem" conflicts with namespaces/classes having the same name

2017-04-09 Thread J Decker
On Sun, Apr 9, 2017 at 12:20 PM, Richard Damon 
wrote:

> On 4/9/17 1:49 PM, Olivier Mascia wrote:
>
>> Le 9 avr. 2017 à 18:49, dip  a écrit :
>>>
>>> I downloaded latest SQLite Amalgamation (v 3.18.0) to embed it in my
>>> project.
>>> After that I got a lot of errors while compiling (compiler is Microsoft
>>> Visual Studio 2017).
>>> Errors were caused by the following line in sqlite3.h:
>>>
>>> typedef struct Mem sqlite3_value;
>>>
>>> The reason is that I have the namespace with the same name.
>>> So I have a suggestion to rename "struct Mem" to something else (add
>>> prefix to it) because "Mem" is a very common name like "input" or "data" or
>>> "buffer" and there may be classes or namespaces having the same name.
>>>
>> The way to overcome this completely in large programmings using many
>> libraries is to include sqlite3.h within a namespace. Not something that
>> SQLite code must do itself: that's best handled at the user project level.
>>
>> The problem with this is that if the header file is put in a namespace in
> the user code, then the source file that defines these functions needs to
> also be changed to put the files in that same namespace, or the things
> being defined won't be found.
>
> think that's what 'use namespace' is for


> --
> Richard Damon
>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] "struct Mem" conflicts with namespaces/classes having the same name

2017-04-09 Thread Richard Damon

On 4/9/17 1:49 PM, Olivier Mascia wrote:

Le 9 avr. 2017 à 18:49, dip  a écrit :

I downloaded latest SQLite Amalgamation (v 3.18.0) to embed it in my project.
After that I got a lot of errors while compiling (compiler is Microsoft Visual 
Studio 2017).
Errors were caused by the following line in sqlite3.h:

typedef struct Mem sqlite3_value;

The reason is that I have the namespace with the same name.
So I have a suggestion to rename "struct Mem" to something else (add prefix to it) because "Mem" is a very 
common name like "input" or "data" or "buffer" and there may be classes or namespaces having the 
same name.

The way to overcome this completely in large programmings using many libraries 
is to include sqlite3.h within a namespace. Not something that SQLite code must 
do itself: that's best handled at the user project level.

The problem with this is that if the header file is put in a namespace 
in the user code, then the source file that defines these functions 
needs to also be changed to put the files in that same namespace, or the 
things being defined won't be found.


--
Richard Damon

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] "struct Mem" conflicts with namespaces/classes having the same name

2017-04-09 Thread Olivier Mascia

> Le 9 avr. 2017 à 18:49, dip  a écrit :
> 
> I downloaded latest SQLite Amalgamation (v 3.18.0) to embed it in my project.
> After that I got a lot of errors while compiling (compiler is Microsoft 
> Visual Studio 2017).
> Errors were caused by the following line in sqlite3.h:
> 
> typedef struct Mem sqlite3_value;
> 
> The reason is that I have the namespace with the same name.
> So I have a suggestion to rename "struct Mem" to something else (add prefix 
> to it) because "Mem" is a very common name like "input" or "data" or "buffer" 
> and there may be classes or namespaces having the same name.

The way to overcome this completely in large programmings using many libraries 
is to include sqlite3.h within a namespace. Not something that SQLite code must 
do itself: that's best handled at the user project level.

-- 
Best regards, Meilleures salutations, Met vriendelijke groeten,  
Olivier Mascia (from mobile device), http://integral.software

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] "struct Mem" conflicts with namespaces/classes having the same name

2017-04-09 Thread dip
I downloaded latest SQLite Amalgamation (v 3.18.0) to embed it in my project.
After that I got a lot of errors while compiling (compiler is Microsoft Visual 
Studio 2017).
Errors were caused by the following line in sqlite3.h:

typedef struct Mem sqlite3_value;

The reason is that I have the namespace with the same name.
So I have a suggestion to rename "struct Mem" to something else (add prefix to 
it) because "Mem" is a very common name like "input" or "data" or "buffer" and 
there may be classes or namespaces having the same name.

Sent with [ProtonMail](https://protonmail.com) Secure Email.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] json() number value parsing

2017-04-09 Thread Olivier Mascia
> Le 9 avr. 2017 à 03:08, Jens Alfke  a écrit :
> 
>> On Apr 7, 2017, at 5:26 PM, Rolf Ade  wrote:
>> ./sqlite3 
>> SQLite version 3.19.0 2017-04-07 20:20:08
>> [...]
>> sqlite> select json(' { "this" : 000.23 } ');
>> {"this":000.23}
>> If I read RFC 7159 (http://www.rfc-editor.org/rfc/rfc7159.txt 
>> ) correct
>> this should return: "Error: malformed JSON".
> 
> In this case I would go with Postel’s Law, paraphrased as “Be strict in what 
> you write, but lenient in what you read.” I don’t see a point in disallowing 
> something as trivial as redundant leading zeroes.

If you'd go with Postal's Law, you would make it so:

sqlite> select json(' { "this" : 000.23 } ');   // be lenient in what you read
{"this":0.23}   // be strict in what you write

:)

-- 
Best Regards, Meilleures salutations, Met vriendelijke groeten,
Olivier Mascia, http://integral.software


___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Crash while rollback database in journal_mode=DELETE

2017-04-09 Thread Taewon Park
Thank you for your quick reply!

> If so, please tell us the email address that is associated with your SEE
license.

Unfortunately I'm using my own implementation, not SEE. Of course via
SQLite3 C API interface, such as sqlite3CodecAttach and etc.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users